Chaining isn't bad, but it only gives you a reference for the model,
it doesn't set any conditions. You have to pass them manually to the
findAll().
You can unbind() the models you don't want to get on the findAll and
set the recursion level that fits your needs. Also it is possible to
set conditions dinamically on the associations through
Model::bindModel();
Also if you are using CakePHP 1.2 you can use the bindable behavior
(thanks Mariano) to control your associations.
HTH,
- Dardo Sordi.
On Jan 18, 2008 10:54 PM, the_woodsman <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm not sure I fully understand your problem, but:
>
>
> > I'd like to figure out how to do something like:
> > $this->set('friends', $this->User->Friends->Profiles->findAll());
> > This returns every profile in the system, not just those for the
> > user's friends.
>
> Your controller isn't tied to usingjust one Model, the $uses array of
> the Controller can specify all the models you want:
>
> var $uses=array('Profiles','User');
>
> then you can start all your queries from these models, no need to
> chain them as above.
>
> > how to access the specific data I want without doing 2 or 3
> > levels of recursion on a find() for the user.
>
> There are various ways to tweak Cake queries, like setting the
> recursion level, or which tables to join for any particular query.
>
>
>
> Jan 18, 11:09 pm, Chris Wade <[EMAIL PROTECTED]> wrote:
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---