@@ -410,22 +410,13 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
410
410
}
411
411
}
412
412
413
- When using a Doctrine event listener or subscriber, when you make changes
414
- to your entity, the preUpdate() callback must have an extra line of code to
415
- tell Doctrine about the change::
416
-
417
- public function preUpdate(PreUpdateEventArgs $args)
418
- {
419
- $entity = $args->getEntity();
420
- // do all the file uploading logic
421
- // ...
422
- $entity->setFilename($newFilename);
423
- $args->setNewValue('filename', $newFilename);
424
- }
425
-
426
- For full reference on preUpdate event restrictions, see `preUpdate `_ in the
427
- Doctrine Events documentation.
413
+ ..caution ::
428
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.
429
420
430
421
The class now does everything you need: it generates a unique filename before
431
422
persisting, moves the file after persisting, and removes the file if the