API Platform version(s) affected: 2.5
Description
Wrong recognition whether the Doctrine ORM Paginator should use output walkers.
Previously (in APIP2.4) it worked fine, but after recent code changes it's broken.
How to reproduce
In my custom filter I use the following code:
$queryBuilder->addSelect(sprintf('CASE WHEN %s.%s = FALSE THEN 0 ELSE 1 END AS HIDDEN %s', $alias, 'showOnGrid', $nullRankHiddenField));
It's necessary to add this expression into OrderBy clause.
In QueryChecker::hasOrderByOnFetchJoinedToManyAssociation() there is a following logic:
foreach (QueryBuilderHelper::traverseJoins($orderByAlias, $queryBuilder, $managerRegistry) as $alias => [$metadata, $association]) {
if ($inToManyContext && \in_array($alias, $selectAliases, true)) {
return true;
}
if (null !== $association && $metadata->isCollectionValuedAssociation($association)) {
$inToManyContext = true;
}
}
As you can see, you check join name against selectAlias, but selectAlias is smth like "case ..." and the code above will never return true.
Possible Solution
As this moment I reverted back the previous version of this method.
Additional Context
API Platform version(s) affected: 2.5
Description
Wrong recognition whether the Doctrine ORM Paginator should use output walkers.
Previously (in APIP2.4) it worked fine, but after recent code changes it's broken.
How to reproduce
In my custom filter I use the following code:
It's necessary to add this expression into
OrderByclause.In
QueryChecker::hasOrderByOnFetchJoinedToManyAssociation()there is a following logic:As you can see, you check
joinname againstselectAlias, butselectAliasis smth like "case ..." and the code above will never returntrue.Possible Solution
As this moment I reverted back the previous version of this method.
Additional Context