Issue
I have my base Model Affiliate that hasMany AffiliatePayout and these AffiliatePayouts belongTo a Payout. Now I'm doing a $this->Affiliate->find('all', array())
and its returning an array of AffiliatePayouts but I would also like to get the Payout that belongsTo the AffiliatePayout returned along with the results. I've racked my brain most of the day trying to figure this out and can't seem to find an answer.
Solution
Try this:
$this -> Affiliate -> find('all', array('contain' => 'Payout'))
Here you have more info about Containable Behavior
http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html
Answered By - Jacek B Budzynski
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.