【发布时间】:2016-12-07 09:05:09
【问题描述】:
我正在使用以下查询来显示数据列表,但这里的限制不起作用。
$query = $this->Bookings->find('all')
->where(['Bookings.user_id' => $id])
->contain(['Services'])
->limit(10)
->orderDesc('booking_date');
$this->set('bookings', $this->paginate($query));
$this->set('_serialize', ['bookings']);
但是,我没有得到每页中 10 个数据的列表。
【问题讨论】:
-
试试把
->orderDesc('booking_date')->limit(10);