我正面臨一個亟待解決的問題。我已經編寫了分頁代碼。一切都按預期工作,但只有條件不起作用(只有某些條件) 這是我的分頁代碼。Cake Php paginator問題
//declaration
public $paginate = array(
'limit' => 50,
'paramType' => 'querystring'
);
//use in action
$this->paginate['ApiLog'] = array('limit' => 50, 'order' => 'ApiLog.id DESC', 'paramType' => 'querystring');
$this->paginate['ApiLog']['conditions'] = array('ApiLog.log_type' => 2);
$this->paginate['ApiLog']['joins'] = array(
array(
'table' => 'users',
'alias' => 'User',
'type' => 'LEFT',
'conditions' => array('User.id = ApiLog.user_id')
)
);
$this->Paginator->settings = $this->paginate['ApiLog'];
$apilogs = $this->Paginator->paginate('ApiLog');
這個代碼在開發環境知府並返回患有2型日誌,但它在生產只返回的類型爲1.我花了整整一天,以找出問題的日誌。 如果我確實在conditions array
中添加了其他任何條件,但是不會生效log_type
。 我打印查詢日誌,在where clause
它總是顯示log_type = '1'
我也清除了緩存。 任何幫助表示感謝,謝謝。
試着刪除你的'tmp/cache'文件夾 – om1