Your statement the problem with CakePHP is that it only allows a
controller to access its own corresponding model's data is just flat
wrong. You can access additional models in a controller by simply adding
the model name to the $uses variable in the controller class.
For example, the following allows you to access both the Recipe and User
models in the Recipe controller (you can find more in the book
at http://book.cakephp.org/2.0/en/controllers.html):
class RecipesController extends AppController {
public $uses = array('Recipe', 'User');
.
public function someAction() {
.
$user = $this-User-find('first', array('conditions'=array('id',
$userId)));
.
}
}
You can also achieve what you wish by using model associations. See:
http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html
In your Table1 model class, you define a $hasMany association with Table2,
and in your Table2 model you define a $hasMany association with Table3. You
can then access the lower level associations by doing a find() on Table1.
You should also look at the Containable behavior. It makes it easy to
define which models are retrieved when a find() is done. Containable is so
handy I have put it in my AppModel class so all models have that behavior.
See:
http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html
All of what you need to do this is described in the book and the examples.
Study them. Try them. If you then have trouble, we'll answer your questions.
Ken
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.