We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent afb1a60 commit 8e6b9f6Copy full SHA for 8e6b9f6
doctrine/associations.rst
@@ -375,11 +375,7 @@ following method to the ``ProductRepository`` class::
375
WHERE p.id = :id'
376
)->setParameter('id', $productId);
377
378
- try {
379
- return $query->getSingleResult();
380
- } catch (\Doctrine\ORM\NoResultException $exception) {
381
- return null;
382
- }
+ return $query->getOneOrNullResult();
383
}
384
385
Now, you can use this method in your controller to query for a ``Product``
0 commit comments