If your code works fine on the local computer but does not work during production, you need to clear all the files in tmp/cache/model and tmp/cahe/persistance . make sure you grant write permissions to the tmp folder.
This means that you need to update the Cake model schema when adding a new field, deleting an existing field, or making any changes to the database schema. In production mode If a schema cache file is not found, it will create new cache files based on the current schema in the database. In design mode, at each execution, it updates the schema cache.
Still its pagination problem, then you should follow the CakePHP 2.x documentation. Here, I assume your code is in ApiLogsController and the method is index . in accordance with the documentation should be your code.
public function index() { $this->Paginator->settings = array( 'limit' => 50, 'order' => 'ApiLog.id DESC' 'paramType' => 'querystring', 'conditions'=> array('ApiLog.log_type' => 2), 'recursive'=>-1, // should be used with joins 'joins'=>array( array( 'table'=>'users', 'type'=>'LEFT', 'alias'=>'User', 'conditions'=>array('User.id = ApiLog.user_id') ) ) ); $data = $this->Paginator->paginate('ApiLog'); $this->set(compact('data')); }
OR
// your default setting in ApiLogController class public $components = array('Paginator'); public $paginate = array( 'limit' => 50, 'paramType' => 'querystring' ); public function index() { // overriding/extending default settings $this->Paginator->settings['order']='ApiLog.id DESC'; $this->Paginator->settings['conditions']=array('ApiLog.log_type' => 2), $this->Paginator->settings['recursive']= -1; $this->Paginator->settings['joins']=array( array( 'table'=>'users', 'type'=>'LEFT', 'alias'=>'User', 'conditions'=>array('User.id = ApiLog.user_id') ) ); $data = $this->Paginator->paginate('ApiLog'); $this->set(compact('data')); }
Haresh vidja
source share