【发布时间】:2018-07-13 11:01:19
【问题描述】:
我在具有多个连接的控制器中有如下查询
$deals = $this->Deals->find('all', array(
'fields' => array(
'Deals.id',
'Deals.deed_amount',
'Deals.other_amount',
'Deals.cash_amount',
'Deals.total_amount',
'Deals.client_id',
'Deals.project_id',
'Deals.property_id',
'Deals.properties_flat_id',
'Deals.date',
'Deals.status',
'Deals.invoice_no',
'Deals.remain_cash_amount',
'Deals.remain_deed_amount',
'Deals.remain_other_amount',
'Deals.remain_deed_amount',
'Property.name',
'Client.name',
'PropertyFlat.name',
'PropertyFlat.status'
),
'joins' => array(
array(
'table' => 'properties',
'alias' => 'Property',
'type' => 'LEFT',
'conditions' => array(
'Deals.property_id = Property.id'
)
),
array(
'table' => 'clients',
'alias' => 'Client',
'type' => 'LEFT',
'conditions' => array(
'Deals.client_id = Client.id'
)
),
array(
'table' => 'properties_flats',
'alias' => 'PropertyFlat',
'type' => 'LEFT',
'conditions' => array(
'Deals.properties_flat_id = PropertyFlat.id'
)
)
),
// 'conditions'=>$condition
));
我想为视图添加分页。我试过了
$this->set('deals', $this->Paginator->paginate($deals));
但是没有用。请帮助我如何为自定义查询添加分页。我搜索了很多链接,但没有得到任何帮助。
【问题讨论】:
-
我想为自定义查询添加分页
-
您需要在数组中添加限制和页面参数
-
如何加入分页