cakephp分页中的问题

时间:2015-01-24 18:05:54

标签: cakephp cakephp-2.3

我使用此代码获取基于类别的数据

$this->paginate=$this->Project->find('all', array('conditions' => array('category' => $this->request->data['Project']['category'])));
        $this->set('projects', $this->paginate);

使用上面的代码我收到这些错误

Warning (2): array_filter() expects parameter 1 to be array, null given [CORE\Cake\View\Helper\PaginatorHelper.php, line 403]
Warning (2): array_merge() [function.array-merge]: Argument #1 is not an array [CORE\Cake\View\Helper\PaginatorHelper.php, line 403]

我如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

你的代码错了。

使用:

$this->Paginator->settings = array('conditions' => array('Project.category' => $this->request->data['Project']['category']));
$this->set('projects', $this->Paginator->paginate());