Join 3 tables using the Doctrine_RawSql object

Is there any way to make this choice:

SELECT * 
FROM `sf_guard_user` 
JOIN `friendship` 
  ON `friendship`.`user_id` = `sf_guard_user`.`id` 
JOIN `circle` 
  ON `friendship`.`circle_id` = `circle`.`id` 
WHERE `circle`.`id` = 1 
ORDER BY `circle`.`id`

with a Doctrine_RawSql object without using foreign keys?

+3
source share
1 answer

Why did you decide to use Doctrine_RawSql?

In this example, I use inner join:

SELECT sf.* FROM `sf_guard_user` sf
INNER JOIN `friendship` f on  f.`user_id` = sf.`id` 
INNER JOIN `circle` c on f.`circle_id` = c.`id` 
WHERE c.`id` = 1 
ORDER BY c.`id`
+1
source

Source: https://habr.com/ru/post/1796051/


All Articles