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

Commit2d1ecd9

Browse files
committed
featuresymfony#3525 Update file_uploads.rst (juanmf)
This PR was submitted for the 2.4 branch but it was merged into the 2.3 branch instead (closessymfony#3525).Discussion----------Update file_uploads.rstCode examples do not apply to Doctrine EventSubscribers scenario, on preUpdate.Cheers.Commits-------075612a Going back to the ``Caution`` alternative.2e21a0b Rewording Caution paragraph at line 4133b0c75d Update file_uploads.rst25539c5 Update file_uploads.rst
2 parentsb1e8f56 +d920148 commit2d1ecd9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎cookbook/doctrine/file_uploads.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,14 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
410410
}
411411
}
412412

413+
..caution::
414+
415+
If changes to your entity are handled by a Doctrine event listener or event
416+
subscriber, the ``preUpdate()`` callback must notify Doctrine about the changes
417+
being done.
418+
For full reference on preUpdate event restrictions, see `preUpdate`_ in the
419+
Doctrine Events documentation.
420+
413421
The class now does everything you need: it generates a unique filename before
414422
persisting, moves the file after persisting, and removes the file if the
415423
entity is ever deleted.
@@ -546,3 +554,5 @@ You'll notice in this case that you need to do a little bit more work in
546554
order to remove the file. Before it's removed, you must store the file path
547555
(since it depends on the id). Then, once the object has been fully removed
548556
from the database, you can safely delete the file (in ``PostRemove``).
557+
558+
.. _`preUpdate`:http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#preupdate

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp