I have problem with QueryBuilder, i have three tables:
"counter" "cost_tp" "counter_cost_tp" (relation many to many between counter and cost_tp)
In raw SQL i can create query:
SELECT 
  `counter`.`name`, 
  `cost_tp`.`name` 
FROM 
  `counter` 
  RIGHT JOIN `counter_cost_tp` ON `counter`.`id` = `counter_cost_tp`.`counter_id` 
  JOIN `cost_tp` ON `cost_tp`.`id` = `counter_cost_tp`.`cost_tp_id`
I tried to do the same in QueryBuilder in Symfony:
$builder
    ->select(['c', 'ct'])
    ->from(CostTp::class, 'ct')
    ->innerJoin('ct.counters', 'c')
    ->distinct();
But it not works fine, return only results from CostTp and first counter. When i tried to run getQuery()->getSQL() the raw sql works fine, but getQuery->getResult() return bad results.
Do you have any fine method to right join in QueryBuilder?
 
    