Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend Join spec with conditions #197

Open
mitrae opened this issue May 23, 2019 · 2 comments
Open

Extend Join spec with conditions #197

mitrae opened this issue May 23, 2019 · 2 comments

Comments

@mitrae
Copy link

mitrae commented May 23, 2019

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
Copy link
Member

This feature has already been discussed #122. I am not sure that this feature is necessary.

@peter-gribanov
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants