Friday, February 26, 2010

Re: Selecting only certain models in a findAll

Take a look at the Containable Behavior:
http://book.cakephp.org/view/474/Containable
Exactly what you need.

On 26 fev, 11:47, Bart <vangeneug...@gmail.com> wrote:
> Hi,
>
> I've modeled my Cake application User centered.
> - A User hasAndBelongsTo many Projects
> - A User hasMany Posts
> - A User belongsTo many Groups
> etc etc
>
> Now I'm trying to get a list of all the Projects for that User.
> However doing a findAll() gives me way too much information (as I can
> see in debug).
> I don't want to fill my memory with al the user's posts when I'm
> simply getting a list of projects.
>
> How can I define which models to load when using a find() method?
> eg. Only load User, Group and Project. But not Posts
>
> thanks,
> Bart

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

No comments: