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

Commit075612a

Browse files
committed
Going back to theCaution alternative.
1 parent2e21a0b commit075612a

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

‎cookbook/doctrine/file_uploads.rst

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

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::
428414

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.
429420

430421
The class now does everything you need: it generates a unique filename before
431422
persisting, moves the file after persisting, and removes the file if the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp