Return to Snippet

Revision: 68930
at March 20, 2015 00:36 by satie83


Initial Code
->leftJoin('a.installations', 'i', 'WITH', 'i.page = :page')
->setParameter('page', $page)

Initial URL
http://stackoverflow.com/questions/19185587/left-join-on-condition-and-other-condition-syntax-in-doctrine

Initial Description
In SQL I can get this by adding AND to the join

LEFT JOIN installations i ON a.id = i.app AND i.page = :page
This way I get the installation info for an app that has an installation on the page, but I get null values on the columns for app's that have installations on other pages or not at all.

Is there a way to do this in Doctrine or am I better off just getting all the installations for each application and then checking against the found page with php?

##########################################################################

See function leftJoin in doc: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html#high-level-api-methods

Initial Title
PHP - Doctrine - Left join ON condition AND other condition syntax in Doctrine

Initial Tags
mysql, sql

Initial Language
PHP