On Thu, Nov 18, 2010 at 11:03 AM, Dan <dannyetdi...@gmail.com> wrote:
> When using contain, I have to specify the $actAs = Containable for it
> to work, correct?

Yes, of course. Just as with any other behavior. If you plan to use it
a lot you can put it in AppModel's $actsAs array.

> 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)?

You have to specify all models for which you want data, and there must
be a chain of association running through them. If you have User <->
Comment, and Comment <-> Tag, and you want a User's Tags, you must
specify Comment in your contain array so that the behavior can work
out how to get at Tag (and which ones to look for). Although it's not
necessary to fetch the entire Comment, if you do provide a fields
array for any of the contained models it should include the primary
key and any relevant foreign keys.

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