Skip to content

Commit de2c31e

Browse files
ambroisemaupateabluchet
authored andcommitted
[#1313] LIMIT and ORDER BY on a column from a fetch joined to-many association
1 parent 140ba7a commit de2c31e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Bridge/Doctrine/Orm/Util/QueryChecker.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,14 @@ public static function hasOrderByOnToManyJoin(QueryBuilder $queryBuilder, Manage
150150
$relationship = QueryJoinParser::getJoinRelationship($join);
151151

152152
if (false !== strpos($relationship, '.')) {
153-
$metadata = QueryJoinParser::getClassMetadataFromJoinAlias($alias, $queryBuilder, $managerRegistry);
154-
if ($metadata->isCollectionValuedAssociation($relationship)) {
153+
/*
154+
* (Cannot select distinct identifiers from query with LIMIT and ORDER BY on a column from a fetch joined to-many association. Use output walkers)
155+
*
156+
* @see https://github.com/api-platform/core/issues/1313
157+
*/
158+
list($parentAlias, $association) = explode('.', $relationship);
159+
$metadata = QueryJoinParser::getClassMetadataFromJoinAlias($parentAlias, $queryBuilder, $managerRegistry);
160+
if ($metadata->isCollectionValuedAssociation($association)) {
155161
return true;
156162
}
157163
} else {

0 commit comments

Comments
 (0)