Can you join on a subquery with Doctrine 2 DQL?(您可以使用 Doctrine 2 DQL 加入子查询吗?)
问题描述
有没有办法在连接的 WITH
子句中访问连接实体的关系?我试图避免在子查询中使用 IN
子句.
Is there a way to access a joined entity's relation in the WITH
clause of a join? Im trying to avoid using an IN
clause with a subquery.
或者有没有办法加入子查询而不是使用IN
?
Or is there a way to join on a subquery rather than using IN
?
即确保连接对象的 t.final
值为 1.
i.e. Making sure the joined object's t.final
value is 1.
尽量避免这个查询
重写尝试失败:无法访问 s.serviceType.final
订单实体:
服务请求实体:
服务类型实体:
推荐答案
您在加入 servicetype 之前查询它.试试:
You're querying servicetype before it is joined. Try:
这篇关于您可以使用 Doctrine 2 DQL 加入子查询吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!