Extend Join spec with conditions
mitrae opened this issue · 2 comments
mitrae commented
To join entity which does not have relation with master entity.
In QueryBuilder:
$qb->join(SomeEntity::class, 'se', Join::WITH, 'e.id = se.id');
Spec.php
public static function join($field, $newAlias, $dqlAlias = null, $conditionType = null, $condition = null)
{
return new Join($field, $newAlias, $dqlAlias, $conditionType, $condition);
}
AbstractJoin.php
public function modify(QueryBuilder $qb, $dqlAlias)
{
if (null !== $this->dqlAlias) {
$dqlAlias = $this->dqlAlias;
}
$join = $this->getJoinType();
$field = null !== $conditionType ? $this->field : sprintf('%s.%s', $dqlAlias, $this->field);
$qb->$join($field, $this->newAlias, $conditionType, $condition);
}
peter-gribanov commented
This feature has already been discussed #122. I am not sure that this feature is necessary.
peter-gribanov commented
It does not really matter how to set the rules via JOIN WITH or WHERE. Can you give an example when the use of JOIN WITH is preferable?