>
> I have a groups, users and tasks models.
>
> Groups has a HABTM to users.
> Users has a HABTM to groups.
> Users has many tasks.
>
> From the tasks model, I am trying to find out which group the user
> belongs to. Once I have this information, I plan to put into a session
> variable so I only need to query this once while the user is in
> session.
>
> But, how do I make this query efficiently?
I'm not sure if I understood your question. On your
controller, set the recursive property to the Task
model to 2 and get the full resultset with a
find('all') method, like
$this->Task->recursive= 2;
$all= $this->Task->find('all');
Be sure that your models are correctly associated.
Best regards.
--
MARCELO DE F. ANDRADE (aka "eleKtron")
Belem, PA, Amazonia, Brazil
Linux User #221105
[gus@pará ~]# links http://pa.slackwarebrasil.org/
--~--~---------~--~----~------------~-------~--~----~
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