We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c98a3da commit 7acc0d2Copy full SHA for 7acc0d2
book/doctrine.rst
@@ -737,7 +737,11 @@ a controller, do the following::
737
738
$products = $query->getResult();
739
740
-The ``getResult()`` method returns an array of results.
+The ``getResult()`` method returns an array of results. To get only one
741
+result, you can use ``getSingleResult()`` (which throws exception there is no
742
+result) or ``getOneOrNullResult()``::
743
+
744
+ $product = $query->getOneOrNullResult();
745
746
If you're comfortable with SQL, then DQL should feel very natural. The biggest
747
difference is that you need to think in terms of "objects" instead of rows
0 commit comments