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

Commit7acc0d2

Browse files
committed
Reverted removal of getSingleResult()
It's now smaller (25 to 3 lines) and uses getOneOrNullResult().
1 parentc98a3da commit7acc0d2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎book/doctrine.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,11 @@ a controller, do the following::
737737

738738
$products = $query->getResult();
739739

740-
The ``getResult()`` method returns an array of results.
740+
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();
741745

742746
If you're comfortable with SQL, then DQL should feel very natural. The biggest
743747
difference is that you need to think in terms of "objects" instead of rows

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp