In the controller:
var $paginate = array(
'Document' => array(
'fields' => array('Document.*'),
'contain'=>array(
'User'=>array(
'fields' => array('User.id','User.surname','User.name'),
'conditions' => array('User.active'=>1)
)
)
)
)
);
$paging = $this->paginate('Document', array('Document.id'=>$id));
On Jul 6, 7:37 am, "[email protected]"
<[email protected]> wrote:
> Hi
> I have a containable model.
> I would apply the pagination on the results inside contain.
> Example:
>
> Models : Document hasMany User
>
> In documents_controller.php I have this:
>
> $document=$this->Document->find('first',
> array(
> 'fields' => array('Document.*'),
> 'conditions' => array('Document.id'=>$id),
> 'contain'=>array(
> 'User'=>array(
> 'fields' => array('User.id','User.surname','User.name'),
> 'conditions' => array('User.active'=>1)
> )
> )
> )
> );
>
> In the view I would get the pagination on the users.
> Is it possible to do this?
> How I set "paginate" to do this?
> Many Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---