Skip to content

Commit 808da21

Browse files
committed
[cookbook][upload] Adding a warning message about the Doctrine update events not being fired. We will need a more instructive solution.
1 parent 81f3af8 commit 808da21

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cookbook/doctrine/file_uploads.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,15 @@ entity is ever deleted.
307307
other hand, the ``@ORM\PreUpdate()`` and ``@ORM\PostUpdate()`` event
308308
callbacks are called when the entity is updated.
309309

310+
.. caution::
311+
312+
The ``PreUpdate`` and ``PostUpdate`` callbacks are only triggered if there
313+
is a change in one of the entity's field that are persisted. This means
314+
that, by default, if you modify only the ``$file`` property, these events
315+
will not be triggered, as the property itself is not directly persisted
316+
via Doctrine. One solution would be to use an ``updated`` field that's
317+
persisted to Doctrine, and to modify it manually when changing the file.
318+
310319
Using the ``id`` as the filename
311320
--------------------------------
312321

0 commit comments

Comments
 (0)