Symfony2 QueryBuilder join ON and WITH difference

后端 未结 2 1152

I\'m new with Symfony2 and I built successfully my first join through QueryBuilder and Doctrine 2. Probably this is a stupid question but both on-line and in the Symfony2\'s

2条回答
  •  时光取名叫无心
    2020-12-16 10:18

    In theory, ON permits you to give the full join criterias, while WITH permits to add additional criterias to the default ones (IMHO).

    But, what DQL permits is to avoid giving the JOIN criterias:

    You just have to say: $qb->leftJoin('prod.pdata', 'pdata');

    And doctrine2 will handle the join correctly.

    Here is a related question about that: Can I use "ON" keyword in DQL or do I need to use Native Query?

提交回复
热议问题