gpt4 book ai didi

php - "Couldn' t 找到类“Doctrine 子查询

转载 作者:行者123 更新时间:2023-11-29 02:06:42 25 4
gpt4 key购买 nike

我正在使用 Symfony 1.4 和 Doctrine。我有一个名为 Image 的 Doctrine 类和一个(应该)通过查询查找下一个和上一个值的方法。违规代码如下所示:

$q = Doctrine_Core::getTable('Image')->createQuery()
->from('Image i')
->where('i.id = (select max(a.id) from Image a where ? > a.id and is_active = 1)', $this->getId())
->orWhere('i.id = (select min(b.id) from Image b where ? < b.id and is_active = 1)', $this->getId());

我总是得到

500 | Internal Server Error | Doctrine_Exception Couldn't find class a

错误。有什么提示吗?

最佳答案

好吧,事实证明 Doctrine 在这种情况下是区分大小写的。工作代码如下所示:

$q = Doctrine_Core::getTable('Image')->createQuery()
->from('Image i')
->where('i.id = (SELECT MAX(a.id) FROM Image a WHERE ? > a.id AND is_active = 1)', $this->getId())
->orWhere('i.id = (SELECT MIN(b.id) FROM Image b WHERE ? < b.id AND is_active = 1)', $this->getId());

关于php - "Couldn' t 找到类“Doctrine 子查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4693796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com