Thursday, September 3, 2009

Re: Complex model associations, pagination and containable

Yep, your version looks like it's the same as mine, but mine doesn't
work.
Anything missing?

I've followed the manual, but it doesn't provide an example for deep
associations with paginate unfortunately.

On Sep 3, 11:20 pm, Alexandru Ciobanu <ics.cake...@gmail.com> wrote:
> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: