Skip to content

Commit

Permalink
AbstractORMCriteriaBuilder should allow left joins
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof Gzocha committed Apr 10, 2017
1 parent 7e04b6e commit e0a0a2b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ protected function join(QueryBuilder $queryBuilder, $join, $alias, $joinType)

$joinParts = $queryBuilder->getDQLPart('join');
if (!array_key_exists($entity, $joinParts)) {
if (Join::LEFT_JOIN === $joinType) {
return $queryBuilder->leftJoin($join, $alias);
}
return $queryBuilder->join($join, $alias);
}

Expand All @@ -66,7 +69,7 @@ protected function join(QueryBuilder $queryBuilder, $join, $alias, $joinType)
* @param string $join
* @param string $joinType
*
* @return QueryBuilder|static
* @return QueryBuilder
*/
protected function filterExistingJoins(
QueryBuilder $queryBuilder,
Expand All @@ -88,6 +91,10 @@ function(Join $joinObj) use ($alias, $join, $joinType) {
return $queryBuilder;
}

if (Join::LEFT_JOIN === $joinType) {
return $queryBuilder->leftJoin($join, $alias);
}

return $queryBuilder->join($join, $alias);
}
}

0 comments on commit e0a0a2b

Please sign in to comment.