If you change only the download field, the life cycle does not start the download method. The cookbook reports the decision in the quote box, as shown below:
The PreUpdate and PostUpdate callbacks are only triggered if there is a change in one of the object fields that are saved. This means that by default, if you change only the $ file property, these events will not be triggered, since the property itself is not direct saved through the Doctrine. One solution would be to use an updated field that is saved in the Doctrine, and change them manually when changing the file.
add a dummy field for updating in the controller before saving the event, as duscussion suggests:
https://github.com/symfony/symfony-docs/pull/564
public function setFile(UploadedFile $file) { $this->file = $file; $this->updatedAt = new \DateTime(); }
source share