CakePHP requestAction 返回数据,find('all') 订单查询不起作用?

发布于 2024-10-17 00:11:13 字数 298 浏览 5 评论 0原文

我不知道为什么我的 DESC 排序查询不起作用?根据手册和其他来源,它应该工作正常:

function pd_list() {

    return $this->PlanDetail->find('all', array('order' => 'PlanDetail.name DESC', 'limit' => 10));

}

所有数据都按预期在我的元素中显示,但它不在 DESC 中(并且 10 限制也不起作用)顺序,并且我尝试了几次测试和“顺序” '=>好像没有什么效果?

I do not know why my DESC sort query is not working?? According to the manual and other sources, it should be working fine:

function pd_list() {

    return $this->PlanDetail->find('all', array('order' => 'PlanDetail.name DESC', 'limit' => 10));

}

All data is being displayed as expected in my element, but its not in DESC (and the 10 limit is not working either) order and Ive tried several tests and the 'order' => seems to have no effect?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陪我终i 2024-10-24 00:11:13

乔布,

哇。在我失去了所有头发之后,我没有尝试这样做(现在排序正在工作!):) ..这是我完成的工作功能:

function pd_list() {
    return $this->PlanDetail->find('all',
    array('contain' => false,
    'group' => 'PlanDetail.name',
    'order' => array('PlanDetail.name ASC'),
    'fields' => array('id','name')));
}

Joeb,

Wow. After all the hair I lost, I did not try that (and now the sort is working!) : ) .. Here is my completed working function:

function pd_list() {
    return $this->PlanDetail->find('all',
    array('contain' => false,
    'group' => 'PlanDetail.name',
    'order' => array('PlanDetail.name ASC'),
    'fields' => array('id','name')));
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文