Doctrine2 QueryBuilder SQL

时间:2015-10-30 08:59:24

标签: mysql doctrine-orm

我想用doctrine查询构建器实现以下SQL-Query,但我不知道如何处理左连接中的内连接。目的是为所有餐厅提供特定日期的餐饮可用性和所有餐厅,但在该日期没有空房。

实体关系:

餐厅1:n餐1:n可用性

SQL查询:

SELECT restaurant.id AS restaurant, meal.id AS meal
FROM restaurant
LEFT JOIN (
    meal INNER JOIN meal_availability 
    ON meal.id = meal_availability.meal_id 
    AND meal_availability.date = '2015-10-31'
)
ON restaurant.id = meal.restaurant_id

0 个答案:

没有答案