Core: EagerLoadingExtension does not check for existing joins

Created on 5 Jul 2019  路  3Comments  路  Source: api-platform/core

EagerLoadingExtension does not check whether the query builder already defines exact join clause.
If another extension adds join before the EagerLoadingExtension it will result with duplicate join clauses.

https://github.com/api-platform/core/blob/ee7ef885f8653015fe7f6eeb913aae0d8fb34386/src/Bridge/Doctrine/Orm/Extension/EagerLoadingExtension.php#L200-L201

Hacktoberfest bug easy pick help wanted

All 3 comments

Hi ! I would love to help you on this issue/
I could get all previously used aliases with $queryBuilder->getAllAliases() and check if the current $association matches one part of existing aliases.
What do you think @soyuka @dunglas ?

Hi @victorbrun we have methods like this one:
https://github.com/api-platform/core/blob/5f7eaf3df1e580a41ea7274c2de868f74fc14353/src/Bridge/Doctrine/Orm/Util/QueryChecker.php#L168

They should be used there, what I'd do first is to try to reproduce a failing test case, then I'd try to fix it using these checks.

Not sure if this is obvious but we should check for any join type, not just a lefty.
Cheers

Was this page helpful?
0 / 5 - 0 ratings