联合体上的cakephp 3页
我有一个工会联合体上的cakephp 3页,cakephp,pagination,cakephp-3.0,Cakephp,Pagination,Cakephp 3.0,我有一个工会 $myContacts = $this->Contacts->find() ->matching('Users', function($q) { return $q->where(['Users.id' => 3]); }); $inmygroupsContacts = $this->Contacts->find() ->matching('Gro
$myContacts = $this->Contacts->find()
->matching('Users', function($q) {
return $q->where(['Users.id' => 3]);
});
$inmygroupsContacts = $this->Contacts->find()
->matching('Groups', function($q){
return $q->where(['Groups.id' => 5]);
});
$contacts = $myContacts->union($inmygroupsContacts);
我想把结果分页
$this->paginate($contacts)向我提供en-error:error:SQLSTATE[21000]:基数冲突:1222使用的SELECT语句的列数不同
在分页之前,我试图调用$contacts->execute()和$contacts->all(),但是我遇到了另一个错误:错误:调用未定义的方法Cake\Database\Log\LoggingStatement::alias()
怎么做 现在无法测试它,但我可以想象两种可能的错误来源,
用户
和组
表上的列计数不匹配,以及联合选择在分页器发出的查询中没有用作子查询。$contacts->toArray()给了我正确的结果。所以你的第二个猜测是对的。但是怎么办呢?这似乎是一个错误