0

i have mysql query

 SELECT `users`.`user_id`,  `tool`.`name` FROM `users` LEFT JOIN 
`project` ON
    `users`.`user_id` = `project`.`user_id` LEFT JOIN `tools` ON `users`.'user_id' = `tools`.`user_id` AND `project`.`project_id` = `tools`.`project_id`
    Where project_id = value
    and user_id = value

and my doctrine query is this

    $query = $queryBuilder->select ( array (
                'user.userId',
                'user.name',

            ))
            ->from('Users', 'users')
    ->leftJoin(user.project, project)
    ->leftJoin(user.tool, tool)
    ->where(user.userId = value)
    ->andWhere(project.projectId = value)

now how would i include the AND project.project_id = tools.`project_id part to Doctrine query builder without

Waqar Haider
  • 929
  • 10
  • 33
  • Most probably you have wrong database model, the relation between tables `tool` and `user` is redundant and should not be there. Also, do you really want left joins ? How do your entities look like ? – Miro Apr 10 '16 at 09:28
  • 1
    I think this question answers yours: http://stackoverflow.com/questions/19185587/left-join-on-condition-and-other-condition-syntax-in-doctrine Use the 'WITH' keyword. – hanego Apr 11 '16 at 02:25

0 Answers0