I am using CakePHP paginator on some screens and it working perfectly. On those screen i get data from only one table as per their model.
$where = array('order' => 'id desc', 'conditions' => $conditions);
$this->paginate = $where;
$this->set('my_events', $this->Paginator->paginate('MyEvents')); // Set in Model
No on one screen I get data from three tables separately and merge there data in on array. Now i can not figure it out that how can i use it in paginator. I am trying this
The paginate-function requires the first parameter to to be of type \Cake\Datasource\RepositoryInterface (basically aka Table-classes) or \Cake\Datasource\QueryInterface (basically the object that represents your query against your database).
This makes sense to me as I see pagination mostly as a tool to improve load-times of the site and spare database-resources.
That means you cannot simply use the pagination for arrays - for “workaround” of your problem, you might make use of (nested) associations to get your 3 models into one Query-Object that you can use for paginate-function.