Tuesday, June 9, 2015

Re: containable

On Sunday, June 7, 2015 at 8:33:23 PM UTC+1, Lokesh S wrote:
Can we use containable in a model, Can anyone please suggest me on this ...
 
Containable is a behavior which are applied to models, so the model is exactly where Containable is supposed to be used.

In your Controller you would use 
$this->ModelName->find('all', array(
  'contain' => array('RelatedModel1', 'RelatedModel2')
));

In your Model you would use 
$this->find('all', array(
  'contain' => array('RelatedModel1', 'RelatedModel2')
));

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: