> But, how do I make this query efficiently?
One solution would be to use the Containable behavior with the User
model. Then you can find what groups the user belongs to by doing a
find and including a 'contain' option which is an array containing the
associated models you are interested in (in this case, 'Group').
So for example (in the User model), something like:
function getGroups($userID) {
return $this->find('first', array('conditions' => array
('User.id' => $userID), 'contain' => array('Group')));
}
--~--~---------~--~----~------------~-------~--~----~
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:
Post a Comment