Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd72818d

Browse files
committed
minor#10698 Less code (MohamedElKadaoui)
This PR was submitted for the 3.4 branch but it was merged into the 2.8 branch instead (closes#10698).Discussion----------Less code<!--If your pull request fixes a BUG, use the oldest maintained branch that containsthe bug (seehttps://symfony.com/roadmap for the list of maintained branches).If your pull request documents a NEW FEATURE, use the same Symfony branch wherethe feature was introduced (and `master` for features of unreleased versions).-->Commits-------8e6b9f6 Less code
2 parentsafb1a60 +8e6b9f6 commitd72818d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

‎doctrine/associations.rst‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,7 @@ following method to the ``ProductRepository`` class::
375375
WHERE p.id = :id'
376376
)->setParameter('id', $productId);
377377

378-
try {
379-
return $query->getSingleResult();
380-
} catch (\Doctrine\ORM\NoResultException $exception) {
381-
return null;
382-
}
378+
return $query->getOneOrNullResult();
383379
}
384380

385381
Now, you can use this method in your controller to query for a ``Product``

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp