Convert sql to doctrine symfony or DQL -
hello have 2 many 1 relation in database , use sql query ok can`t convert query mysql dql or querybuilder please me
select * `resturant` left join `food` on `resturant`.`id` = `food`.`resturant_id` `food`.`name`like "%pizza%" group `resturant`.`name`
assuming restaurant
entity linked food
entity through attribute $foods
:
$this->createquerybuilder('restaurant') ->leftjoin('restaurant.foods', 'food') ->where('food.name %pizza%') ->groupby('restaurant.name') ->getquery()->getresult();
Comments
Post a Comment