What is the difference between JOIN ON and JOIN WITH in Doctrine2? What is the difference between JOIN ON and JOIN WITH in Doctrine2? sql sql

What is the difference between JOIN ON and JOIN WITH in Doctrine2?


ON replaces the original join condition,
WITH adds a condition to it.


Example:

[Album] ---OneToMany---> [Track]
  1. Case One

    DQL

    FROM Album a LEFT JOIN a.Track t WITH t.status = 1

    Will translate in SQL

    FROM Album a LEFT JOIN Track t ON t.album_id = a.id AND t.status = 1
  2. Case Two

    DQL

    FROM Album a LEFT JOIN a.Track t ON t.status = 1

    Will translate in SQL

    FROM Album a LEFT JOIN Track t ON t.status = 1