On Feb 28, 1:30 pm, Dhana <[email protected]> wrote:
> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to