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

Commitbb12a80

Browse files
committed
minor#6894 Explain what happens ifflush() fails (ThomasLandauer)
This PR was merged into the 2.7 branch.Discussion----------Explain what happens if `flush()` failsIt should be mentioned _somewhere_ in this chapter, how to verify that the entity has really been persisted. What's the best practice here? try...catch? Or (for INSERT) check if $entity->getId() does exist? => Please expand on that.Also, you could list all possible types of exceptions explicitly.Commits-------460b74a Integrated improvement by javiereguiluzf3b07bf Explain what happens if `flush()` fails
2 parentsbf7c94d +460b74a commitbb12a80

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎doctrine.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,12 @@ Take a look at the previous example in more detail:
555555
``Product`` objects and then subsequently call ``flush()``, Doctrine will
556556
execute 100 ``INSERT`` queries using a single prepared statement object.
557557

558+
..note::
559+
560+
If the ``flush()`` call fails, a ``Doctrine\ORM\ORMException`` exception
561+
is thrown, which you can catch by wrapping the ``flush()`` method in a
562+
``try...catch`` block.
563+
558564
Whether creating or updating objects, the workflow is always the same. In
559565
the next section, you'll see how Doctrine is smart enough to automatically
560566
issue an ``UPDATE`` query if the entity already exists in the database.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp