Monday, November 24, 2008

Re: "find" using HABTM relationship

This might be what you are looking for.
The Containable behavior will do the job.

$options = array(
'conditions' => array('User.id' => 7),
'contain' => array(
'Site' => array('fields' => array('id', 'title'))
)
);
$results = $this->User->find('all', $options);

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

No comments: