2015-01-21 105 views
2

我有(group_id,member_id,city_id)字段的廣告表。這是我的GroupsController-> view方法。與cakephp 3測試版中的HasMany關係的分頁表3測試版

public function view($id = null) { 
    $group = $this->Groups->get($id); 
    $this->paginate = ['conditions'=>['group_id'=>$id] , 'contain'=>['Members', 'Cities']]; 
    $advertisements = $this->paginate($this->Groups->Advertisements); 
    $this->set(compact('group' , 'advertisements')); 
} 

它除了產生真實結果之外,還會生成此警告。

Warning (4096): Argument 1 passed to Cake\Controller\Component\PaginatorComponent::validateSort() must be an instance of Cake\ORM\Table, instance of Cake\ORM\Association\HasMany given, called in D:\xampp\htdocs\project\vendor\cakephp\cakephp\src\Controller\Component\PaginatorComponent.php on line 153 and defined [CORE\src\Controller\Component\PaginatorComponent.php, line 301] 

出了什麼問題?

回答