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

doctrine-orm, dql, join, sql

Solution

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

Example:

[Album] ---OneToMany---> [Track]

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

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

Problem

What is the difference between JOIN ON and JOIN WITH in Doctrine2? I couldn't find any relevant info in the manual.

Original source