2016-12-07 64 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)'; –

回答