Surrender to conventions, it will make your life so much easier in the
long run!  I.e. call your joinModel GroupsUser (table: groups_users)
rather than GroupsMembership.

Try:

// fetch array of group ids
$groups = $this->User->GroupsUser->find('list', array(
  'fields'=>array('GroupsUser.group_id', 'GroupsUser.group_id'),
  'conditions'=>array('GroupsUser.user_id'=>$user_id)
));

// find related posts
$posts = $this->User->GroupsUser->Group->GroupPost->find('all', array(
  'conditions'=>array('GroupPost.group_id'=>$groups)
));

HTH

Paul

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