【发布时间】:2010-11-15 21:21:17
【问题描述】:
在模型中使用 HABTM 关系而不是在控制器的分页变量中使用 JOIN 时遇到问题,数据输出正常,但我无法将项目的限制设置为 20。
我正在根据项目的特性从数据库中选择项目。
我有一个叫做紧急的功能。
我在紧急列表页面上。
这应该获取所有标记为紧急的项目,并且它做得很好,但它会返回所有结果,而不是我在分页函数中设置的 20 的限制,或者如果我在模型中尝试。这是页面数组代码
$paginate = array(
'Project' => array(
'limit' => 20,//works fine when paginating just projects
),
'Feature' => array(
'limit' => 1, //did set this to 20 but when looking thought well its going to be the limit of the feature table which will only be 1 anyway, notl imit for the projects
//also tried this below
'Project' => array(
'limit' => 20,//no luck with this
),
),
);
我用它在我的控制器中分页
$this->paginate('Feature', array(..conditions..)); //this brings all my projects marked urgent but I only want 20!
【问题讨论】: