From b803f06c8f3c518b1a6fef19aba1ec61c69722c8 Mon Sep 17 00:00:00 2001 From: flip111 Date: Tue, 17 Sep 2013 15:07:08 +0200 Subject: [PATCH] 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. --- .../ORM/Tools/Pagination/LimitSubqueryOutputWalker.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php index 2ee5f9056..3b7f0a85a 100644 --- a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php +++ b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php @@ -149,7 +149,9 @@ class LimitSubqueryOutputWalker extends SqlWalker } } - if (count($rootIdentifier) != count($sqlIdentifier)) { + if (count($sqlIdentifier) === 0) { + throw new \RuntimeException('The Paginator does not support Queries which only yield ScalarResults.'); + } elseif (count($rootIdentifier) != count($sqlIdentifier)) { throw new \RuntimeException(sprintf( 'Not all identifier properties can be found in the ResultSetMapping: %s', implode(', ', array_diff($rootIdentifier, array_keys($sqlIdentifier)))