@@ -56,8 +56,8 @@ public function match($specification, ?ResultModifier $modifier = null)
56
56
* @param Filter|QueryModifier $specification
57
57
* @param ResultModifier|null $modifier
58
58
*
59
- * @throw Exception\NonUniqueException If more than one result is found
60
- * @throw Exception\NoResultException If no results found
59
+ * @throw Exception\NonUniqueException If more than one result is found
60
+ * @throw Exception\NoResultException If no results found
61
61
*
62
62
* @return mixed
63
63
*/
@@ -80,7 +80,7 @@ public function matchSingleResult($specification, ?ResultModifier $modifier = nu
80
80
* @param Filter|QueryModifier $specification
81
81
* @param ResultModifier|null $modifier
82
82
*
83
- * @throw Exception\NonUniqueException If more than one result is found
83
+ * @throw Exception\NonUniqueException If more than one result is found
84
84
*
85
85
* @return mixed|null
86
86
*/
@@ -99,8 +99,8 @@ public function matchOneOrNullResult($specification, ?ResultModifier $modifier =
99
99
* @param Filter|QueryModifier $specification
100
100
* @param ResultModifier|null $modifier
101
101
*
102
- * @throw Exception\NonUniqueException If more than one result is found
103
- * @throw Exception\NoResultException If no results found
102
+ * @throw Exception\NonUniqueException If more than one result is found
103
+ * @throw Exception\NoResultException If no results found
104
104
*
105
105
* @return mixed
106
106
*/
@@ -112,6 +112,8 @@ public function matchSingleScalarResult($specification, ?ResultModifier $modifie
112
112
return $ query ->getSingleScalarResult ();
113
113
} catch (DoctrineNonUniqueResultException $ e ) {
114
114
throw new NonUniqueResultException ($ e ->getMessage (), $ e ->getCode (), $ e );
115
+ } catch (DoctrineNoResultException $ e ) {
116
+ throw new NoResultException ($ e ->getMessage (), $ e ->getCode (), $ e );
115
117
}
116
118
}
117
119
@@ -121,16 +123,19 @@ public function matchSingleScalarResult($specification, ?ResultModifier $modifie
121
123
* @param Filter|QueryModifier $specification
122
124
* @param ResultModifier|null $modifier
123
125
*
124
- * @throw Exception\NonUniqueException If more than one result is found
125
- * @throw Exception\NoResultException If no results found
126
+ * @throw Exception\NoResultException If no results found
126
127
*
127
128
* @return mixed
128
129
*/
129
130
public function matchScalarResult ($ specification , ?ResultModifier $ modifier = null )
130
131
{
131
132
$ query = $ this ->getQuery ($ specification , $ modifier );
132
133
133
- return $ query ->getScalarResult ();
134
+ try {
135
+ return $ query ->getScalarResult ();
136
+ } catch (DoctrineNoResultException $ e ) {
137
+ throw new NoResultException ($ e ->getMessage (), $ e ->getCode (), $ e );
138
+ }
134
139
}
135
140
136
141
/**
0 commit comments