public $validator;
public $errors ;
+
+ use \Crud\Controller\ControllerTrait;
+
+ public $components = [
+ 'RequestHandler',
+ 'Crud.Crud' => [
+ 'actions' => [
+ 'index',
+ 'Crud.View',
+ 'Crud.Add',
+ 'Crud.Edit',
+ 'Crud.Delete'
+ ],
+ 'listeners' => [
+ 'Crud.Api',
+ 'Crud.ApiPagination',
+ 'Crud.ApiQueryLog'
+ ]
+ ]
+ ];
+
+
/**
* Initialization hook method.
*
$this->loadComponent('RequestHandler');
+
+
+
$this->loadComponent('Flash');
// $this->loadComponent('Auth', [
$this->RequestHandler->renderAs($this, 'json');
$this->set('_serialize', true);
}
+
+ $pagination = $this->request->paging[$this->modelClass];
+ if (empty($pagination)) {
+ return;
+ }
+
+ $paginationResponse = [
+ 'page_count' => $pagination['pageCount'],
+ 'current_page' => $pagination['page'],
+ 'has_next_page' => $pagination['nextPage'],
+ 'has_prev_page' => $pagination['prevPage'],
+ 'count' => $pagination['count'],
+ 'limit' => $pagination['limit']
+ ];
+
+ $this->set('pagination', $paginationResponse);
+
+ $this->set('paging',$this->request->params['paging']);
+
// $this->RequestHandler->renderAs($this, 'json');
//
// $this->set('_serialize', true);