Reputation: 1692
I dont understand something.
Im using HasLifecycleCallbacks
when im uploading a file. When im creating a new record, file is uploaded fine. But when im trying to change only file, nothing is happend. BUT when i change some other field, e.g "name" and select new file, file is uploaded.
Why this callbacks: PrePersist(), PreUpdate(), PostPersist(), PostUpdate()
, are triggered only when i change some fields other than file input ?
Im using symfony 2 with doctrine2.
Upvotes: 2
Views: 2062
Reputation: 5431
The file property you set is not tracked by Doctrine as an entity field. If you followed the examples, the property that is relevant to Doctrine is probably named "path". Changing the file will not flag the entity as needing to be persisted.
As a workaround, you can set an update date field to the current timestamp on update.
Upvotes: 3