【发布时间】:2023-03-21 10:56:02
【问题描述】:
我有一个相当修改的分页查询,它使用了一些连接等 - 但由于某种原因,paginator->counter() 从不匹配计数查询的结果。
您可以在 http://dev.qreer.com/ 上看到它的运行情况 - 通过选择 LHS 导航上的各种选项,查询输出如下,并且分页器计数似乎非常随机。
知道我可以从哪里开始调试吗?
在作业控制器中:
$this->paginate = $this->Job->paginateParams($data);
$jobs = $this->paginate('Job');
$this->set(compact('jobs'));
在模型中:
function paginateParams($data = null){
//lots of joins + conditions
return array('contain' => $contain, 'recursive' => 0,'joins' => $joins, 'conditions' => $conditions, 'group' => 'Job.id', 'order' => $order);
}
Sample Join(所有连接表和数据表都有内连接):
array(
'table' => 'education_backgrounds',
'alias' => 'EducationBackground',
'type' => 'INNER',
'conditions' => array('EducationBackgroundsJobs.education_background_id = EducationBackground.id'),
),
样品条件:
'EducationBackground.name' => array('Aerospace Engineering');
【问题讨论】:
-
我昨天遇到了同样的问题,当您在分页查询中有一个组时会发生这种情况。没有找到解决办法...
标签: php mysql cakephp pagination cakephp-1.3