CakePHP 1.2到1.3 - 转换findAll

时间:2012-01-24 00:53:38

标签: php cakephp cakephp-1.3

我正在将CakePHP 1.2网站转换为1.3并运行一些问题。由于Model :: findAll已在1.3中删除,我该如何转换这段代码?

$pages = $this->Page->findAll("category like '{$page['Page']['category']}'",null,'sort_order');

2 个答案:

答案 0 :(得分:2)

应该更像是

$pages = $this->Page->find('all', array(
    'conditions' => array('category LIKE' => $page['Page']['category']), 
    'order'=>array(...), 
    'fields'=>array(...)
));

答案 1 :(得分:-1)

我认为它是这样的。

$pages = $this->Page->find('all', array('conditions' => array('category like ' => '{$page['Page']['category']})));