Skip to content

Commit

Permalink
[api-platform#1313] LIMIT and ORDER BY on a column from a fetch joine…
Browse files Browse the repository at this point in the history
…d to-many association
  • Loading branch information
ambroisemaupate authored and abluchet committed Nov 2, 2017
1 parent 60e47ca commit 78de32d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Bridge/Doctrine/Orm/Util/QueryChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,14 @@ public static function hasOrderByOnToManyJoin(QueryBuilder $queryBuilder, Manage
$relationship = QueryJoinParser::getJoinRelationship($join);

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

0 comments on commit 78de32d

Please sign in to comment.