Happyr / Doctrine-Specification

This library gives you a new way for writing queries. Using the Specification pattern you will get small Specification classes that are highly reusable.
MIT License
446 stars 41 forks source link

Correct resolve DQL alias in context in SelectEntity #288

Closed peter-gribanov closed 3 years ago

peter-gribanov commented 3 years ago

The path to the additional alias is specified without taking into account the root alias, and as a result, Doctrine does not know how to build joins.

Example

echo $rep->getQueryBuilder(Spec::addSelect(
    Spec::selectEntity('contestant.user'),
    Spec::selectEntity('contestant'),
))->getDQL();

Result

SELECT
    root,
    contestant.user,
    contestant
FROM
    Questionnaire root

Should be

SELECT
    root,
    user,
    contestant
FROM
    Questionnaire root
INNER JOIN
    root.contestant contestant
INNER JOIN
    contestant.user user