Doctrine2: Arbitrary join and single table inheritance

后端 未结 3 1348
旧巷少年郎
旧巷少年郎 2021-02-20 17:28

Note: This is an ORM limitation reported on the project\'s issue tracker

I\'m facing an issue building a DQL query using the arbitrary join syntax introduced in

相关标签:
3条回答
  • try this

    SELECT a.id, 
           b.id 
    FROM   a 
           INNER JOIN b ON ( a.something = b.something ) and b.type IN ( '1', '2', '3' ) 
    
    0 讨论(0)
  • 2021-02-20 17:52

    This bug is fixed in Doctrine 2.4

    https://github.com/doctrine/doctrine2/issues/2934

    0 讨论(0)
  • 2021-02-20 17:56

    Have you tried an inner join instead a left join? The query that you need probably could

    SELECT a.id, 
           b.id 
    FROM   a 
           INNER JOIN b 
                   ON ( a.something = b.something ) 
    WHERE  b.type IN ( '1', '2', '3' ) 
    

    You can get that changing the function leftJoin by join, or creating the query with the createQuery method for customs queries.

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