如何使用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查询?
答案 0 :(得分:0)
在这种情况下,查询可能很容易重新格式化为通常的非嵌套查询。 据我所知,
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)