Use inner join in doctrine query builder

Use inner join in doctrine query builder

Usually all joined entities are automatically joined and returned by Doctrine. Depending on the fetch (EAGER or LAZY). This is done directly or not. But when you want to filter depending on joined columns, you have to join manually.

You can use strings for this or use the constants provided by Doctrine\ORM\Query\Expr\Join.

$queryBuilder->innerJoin(
    Project::class,    // Entity
    'p',               // Alias
    Join::WITH,        // Join type
    'p.id = c.project' // Join columns
);