2016-12-07 19 views
0

我正在使用以下查詢來顯示數據列表,但此處限制不起作用。限制在查詢中不起作用cakephp 3

$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個數據的列表。

+0

儘量把' - > orderDesc( 'booking_date') - >限制(10)'; –

回答