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

Commit8e6b9f6

Browse files
mel1289javiereguiluz
authored andcommitted
Less code
1 parentafb1a60 commit8e6b9f6

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