On 9/3/2009 9:04 PM, martinp wrote:
> Hello
>
> Is this possible?
>
>               $this->paginate['Model1'] = array(
>                       'contain' =>  array(
>                               'Model2' =>  array(
>                                       'Model3',
>                                       'Model4'
>                               )
>                       ),
>                       'conditions' =>  $conditions
>               );
>               $rows = $this->paginate('Model1');
>
> And if it is why is my code not working?
>
> Model2 belongs to Model1
> Model3 and Model4 belong to Model2
>
>    
Yes, it's possible. Here's an example I'm using:

$this->paginate = array('conditions' => array('Ad.status' => 1, 
'category_id' => $category['Category']['id']),
                                  'contain' => array('Image', 'State', 
'Country', 'Child' => array('Image')));
$this->set('ads',$this->paginate('Ad'));

Ad HABTM Child
Image belongsTo Child

Everything you need to know is in the manual ;-)

HTH

--~--~---------~--~----~------------~-------~--~----~
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