我有以下工作的MySQL查询:
select * from (categories as C
JOIN category_details as CD ON C.current_category_detail_id = CD.id
LEFT JOIN (categorized_items as CI
JOIN item_details as ID ON CI.item_detail_id = ID.id
JOIN items as I ON I.current_item_detail_id = ID.id)
ON CD.id = CI.category_detail_id)
WHERE (CI.current = 1 OR CI.id is NULL)
现在我在Doctrine2 DQL或QueryBuilder中需要它。 我已经为所有实体设置了OneToMany和ManyToOne批注,但是我需要一些东西来使嵌套联接起作用。
有什么想法吗?