我有一个使用EasyAdminBundle进行管理的项目。在一个名为"Post“的实体中,我有字段"title”、"image“和"post”,我希望跟踪它们的变化。属性" image“只存储镜像的文件名--整个上传过程由VichUploaderBundle管理。
如何/在哪里才能确保旧的图像文件在更改时不会被删除,因为它将用于历史记录?
发布于 2016-02-12 15:57:09
在定义映射时,有一种方法可以告诉VichUploaderBundle它不应该自动删除旧文件:
下面是取自捆绑包文档的示例映射配置:
vich_uploader:
db_driver: orm
mappings:
product_image:
uri_prefix: /images/products
upload_destination: %kernel.root_dir%/../web/images/products
inject_on_load: false
# this prevents the file from being deleted on update
delete_on_update: false
# this prevents the file from being deleted when the
# entity itself is deleted
delete_on_remove: truehttps://stackoverflow.com/questions/35355090
复制相似问题