Left join ON condition AND other condition syntax in Doctrine

后端 未结 1 1321
说谎
说谎 2020-12-09 07:59

I\'m using Doctrine\'s querybuilder in Symfony2 to create a query to fetch entities.

My current code looks like this:

$repository = $this->getDoct         


        
相关标签:
1条回答
  • 2020-12-09 08:27

    You can try this :

    use Doctrine\ORM\Query\Expr;
    
    ->leftJoin('a.installations', 'i', Expr\Join::WITH, 'i.page = :page')
    ->setParameter('page', $page)
    

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

    0 讨论(0)
提交回复
热议问题