Thursday, March 25, 2010

missing HABTM associated models

how do you fetch model information that is associated with
tables that have a HBTM relationship?

I have

projects
users
project_users
libraries

projects and users are linked via a HBTM relationship
projects have many libraries (hasMany)

a search returns only the HBTM models and no Libraries (which are
associated with projects)
$projects = $this->Project->User->find('all',
array('conditions'=>array('User.id'=>$userId)));

How do you get the associated information as well?

Thanks,

Johannes

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments: