Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b803f06

Browse files
committed
Improved error messages in Paginator: LimitSubqueryOutputWalker
The already existing follow-up check throwing "Not all identifier properties can be found in the ResultSetMapping: %s" is a much more technical description. If $sqlIdentifier is empty (count 0) it can be concluded that there are no mapped results. An alternative error message could thus be "The Paginator does not support queries without mapped results." (line 153). Possibly '!=' on line 154 could be replaced by '>' because i think this is the only situation that can occur. But since i don't know this for sure, i left it like i found it.
1 parent fe78977 commit b803f06

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ public function walkSelectStatement(SelectStatement $AST)
149149
}
150150
}
151151

152-
if (count($rootIdentifier) != count($sqlIdentifier)) {
152+
if (count($sqlIdentifier) === 0) {
153+
throw new \RuntimeException('The Paginator does not support Queries which only yield ScalarResults.');
154+
} elseif (count($rootIdentifier) != count($sqlIdentifier)) {
153155
throw new \RuntimeException(sprintf(
154156
'Not all identifier properties can be found in the ResultSetMapping: %s',
155157
implode(', ', array_diff($rootIdentifier, array_keys($sqlIdentifier)))

0 commit comments

Comments
 (0)