The default behaviour is called 'recursion', where the find will look for models directly related to the model you are doing the find on. This is usually one level, but by setting var $recursive = n; you'll go to n levels instead. So in theory setting var $recursive = 2; will solve your issue, but it can return a lot more data than you need as it will bring back all models n steps away, not just the ones you really want.
You should use the Containable behaviour (http://book.cakephp.org/view/1323/Containable). This allows you very closely define which data you want returned. Create a file in /app called app_model.php: class AppModel extends Model { var $actsAs = array('Containable'); var $recursive = -1; } This makes every model use the Containable behaviour and effectively turns off recursion. Then your find would be: $people = $this->Person->find( 'all', array( 'contain' => array( 'Adult' => array( 'User' ) ) ) ); You'll see that it mirrors your three step hierarchy (Person->Adult->User). Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 4 Oct 2010, at 22:20, Rob wrote: > Hello Everyone, > > I'm a new user of CakePHP, and have a project where we need to reflect > a 3-step hierarchy of inheritance in our database in a model. > > We have people, adults, and users. All users are adults, and people, > and all adults are people. > > > Ideally our Adults model "hasone" person, and our Users model "hasone" > adult (which would have one person). > > > In my tests, however, we have found that when we instantiate a user, > it only has an adult associated with it, and not a person. > > When we instantiate an adult, it does however have a person beneath > it. > > So in summary, I would like to know if there is a way to instantiate > users, and have the user's adult and person properties come with it. > > Thanks! > Rob B. > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en