$this->paginate = array(
'limit' => 5,
'conditions' => ''
);
$this->paginate['conditions'] = array(
'name LIKE' => '%a'
);
他们注意到:
Notice (8): Indirect modification of overloaded property EmployeeCvsController::$paginate has no effect [APP\Controller\EmployeeCvsController.php, line 137]
有人可以解释一下为什么我不能从数组中更改order元素吗?
答案 0 :(得分:2)
根据book,您可以
1)在控制器中指定$paginate
变量(不在动作中):
public $paginate = array();
或2)只需将其放在一个数组而不是两个数组中:
$this->paginate = array(
'limit' => 5,
'conditions' => array(
'name LIKE' => '%a'
)
);
或3)在第二个引用上使用$paginate
而不是$this->paginate
:
$paginate['conditions'] = array(
'name LIKE' => '%a'
);