控制器中的CakePHP自定义分页/分页器未按预期工作 - 我做错了什么?

时间:2011-07-20 17:41:52

标签: function cakephp sorting controller pagination

我可以让我的发现以任何其他方式工作,但我无法通过分页来实现这一点。我做错了什么?

视野中的输出:

SQL Error: 1054: Unknown column 'fields' in 'where clause'

Warning (2):** Cannot modify header information - headers already sent by (output started at...

控制器操作:

...
$cond = array(
        'fields'     => array('id', 'name', 'provider_network_url', 'application_url'),
        'conditions' => array('PlanDetail.id' => $id),
        'contain'    => array(
            'Company' => array('fields' => array(
                'id',
                'name',
                'company_logo_url',
                'plan_detail_by_company_landing')),
            'Plan'    => array('fields'     => array('id', 'monthly_cost'),
                'Applicant'  => array('fields' => array('id', 'name')),
                'Age'        => array('fields' => array('id', 'name')),
                'State'      => array('fields' => array('id', 'name')),
                'Zip'        => array('fields' => array('id', 'title')),
                'PlanDetail' => array('fields' => array('id', 'name')),
            )));
    $planDetails = $this->paginate('PlanDetail', $cond);
    $this->set(compact('planDetails', $planDetails));
...

1 个答案:

答案 0 :(得分:0)

$this->paginate = array(
        'fields'     => ....,
        'conditions' => ....,
        'contain'    => array(
            'Company' => ...,
            'Plan'    => ....));
    $this->set('planDetails', $this->paginate()));