Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个名为 ContentGroup 的模型和另一个名为 Content 的模型,它们之间存在多对多关系。
中间表有一个名为 Position 的字段,当我尝试编写 DQL 查询以获取与 ContentGroup 关联的所有内容时,我无法使用所涉及的模型或关系的别名来引用 position 字段。
有人试试这个?
谢谢!
考虑中间模型IntModel。
IntModel
没有测试,但这应该工作:
$q = Doctrine::getTable('IntModel')->createQuery('p') ->leftJoin('p.Content as c') ->leftJoin('p.ContentGroup as cg') ->where('cg.id = ?', $my_content_group_id)->fetchOne(); echo $q->getPosition();