From 3ce833fb62522f1f84d48cf8e6511a8fb3af1b6c Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Mon, 26 Dec 2016 02:06:46 +0100 Subject: [PATCH] getSingleScalarResult() returns NULL when the query yields no results `NoResultException` is not thrown in this case. --- lib/Doctrine/ORM/AbstractQuery.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/AbstractQuery.php b/lib/Doctrine/ORM/AbstractQuery.php index 8d901d514..8a73ee8ba 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -796,7 +796,7 @@ abstract class AbstractQuery * @return mixed * * @throws NonUniqueResultException If the query result is not unique. - * @throws NoResultException If the query returned no result. + * @throws NoResultException If the query returned no result and hydration mode is not HYDRATE_SINGLE_SCALAR. */ public function getSingleResult($hydrationMode = null) { @@ -822,10 +822,9 @@ abstract class AbstractQuery * * Alias for getSingleResult(HYDRATE_SINGLE_SCALAR). * - * @return mixed + * @return mixed The scalar result, or NULL if the query returned no result. * * @throws NonUniqueResultException If the query result is not unique. - * @throws NoResultException If the query returned no result. */ public function getSingleScalarResult() {