When using contain, I have to specify the $actAs = Containable for it
to work, correct?

And if you have a linking table (HABTM), would you have to specify
that model in the contain statement or can it be omitted (figured out
by Cake)?

On Nov 18, 10:03 am, euromark <[email protected]> wrote:
> @jeremy
> yes, redundant as long as you dont use find("list")
> in this case (i consider it a bug which i already reported) you will
> need containable
>
> On 18 Nov., 14:54, Jeremy Burns | Class Outfit
>
> <[email protected]> wrote:
> > Yes. If you try and contain a model that is not related (with $hasMany, 
> > $belongsTo etc) it will error. Don't forget that you can daisy chain them 
> > too by using nested arrays. So if you have:
>
> > User->Profile->ProfileData->ProfileDataType
>
> > ...you can do:
>
> > $result = $this->User->find(
> >         'all',
> >         array(
> >                 'contain' => array(
> >                         'Profile' => array(
> >                                 'ProfileData' => array(
> >                                         'ProfileDataType'
> >                                 )
> >                         )
> >                 )
> >         )
> > );
>
> > Happy to be corrected, but I think recursion is redundant when using 
> > contain, so no need to set it to -1 (although I suppose it doesn't hurt).
>
> > Jeremy Burns
> > Class Outfit
>
> > [email protected]http://www.classoutfit.com
>
> > On 18 Nov 2010, at 13:32, Dan wrote:
>
> > > I meant Model relationships. So, they would be required for the
> > > containable behavior to work then?
>
> > > On Nov 18, 8:38 am, Jeremy Burns | Class Outfit
> > > <[email protected]> wrote:
> > >> Do you mean relationships in the database or in the models? They are 
> > >> essential in the models (else Cake won't know how to relate models) and 
> > >> although not a Cake requirement I'd say it is paramount from a 
> > >> performance point of view in the database.
>
> > >> Jeremy Burns
> > >> Class Outfit
>
> > >> [email protected]http://www.classoutfit.com
>
> > >> On 18 Nov 2010, at 12:29, Dan wrote:
>
> > >>> Basically, can containable work without having relationships
> > >>> specified? Or does containable rely on those relationships?
>
> > >>> In some tutorials, they specify to use recursive = -1 and then
> > >>> containable to get more optimized SQL. I can't help but think, what's
> > >>> the point specifying the relationships??
>
> > >>> Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > >>> 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 athttp://groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
>

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