You can try Containable behavior.

In models put

     var $actsAs = array('Containable');


and then in the controller....

     $this->Project->find('all', array('contain' => array('Group' =>
array('User'))));


you can find out more about the Containable behavior in the cook book
http://book.cakephp.org/view/1323/Containable



On Jun 7, 2:54 pm, DrLaban <jbh...@gmail.com> wrote:
> My setup is pretty straightforward;
> User HABTM Group
> Group HABTM Project
> Project HABTM User
>
> I would like to produce a find-query that takes a single project-id
> and builds a hierarchic contact list, in which the users belong to
> their respective group(s).
>
> Something along these lines:
> [Project 1]
>   [Group 1]
>     [User 1]
>     [User 5]
>   [Group 2]
>     [User 1]
>     [User 2]
>     [User 3]
>   [Group 4]
>     [User 3]
>     [User 4]
> ...
>
> Is this possible and if so, how? All I've been able to produce is
> something of a flat structure where I can't match the user to a group;
> [Project 1]
>   [User 1]
>   [User 3]
>   [User 4]
>   [User 6]
>   [Group 1]
>   [Group 3]
>   [Group 4]
>
> This is produced when I do;
> $this->Project->find('all');

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

Reply via email to