如何使用 Doctrine Query Builder 构建嵌套查询?
我的 mysql 查询如下所示:
SELECT subquery1.*
FROM
(SELECT * FROM product
WHERE for_her = true && age_teenagers = true && special = true) subquery1
WHERE subquery1.song_rock =true || subquery1.describe_beauty = true;
如何在 Product Entity Repository 中将其转换为 Doctrine 查询?
最佳答案
在这种情况下,查询可能很容易重新格式化为通常的非嵌套查询。 据我所知
SELECT * FROM product
WHERE for_her = true AND age_teenagers = true AND special = true
and (song_rock =true OR describe_beauty = true)
因此
Select P from Product P
Where P.forHer=true AND P.ageTeenages=true AND P.specials=true and (P.songRock=true OR P.describeBeauty=true)
关于php - Doctrine 查询构建器中的嵌套查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40240876/