我有一个使用EasyAdminBundle进行管理的项目。在一个名为" Post"我有字段"标题","图像"和"发布"我想追踪变化。该物业"图像"只存储图像的文件名 - 完整的上传过程由VichUploaderBundle管理。
如何/在哪里可以对旧图像文件在更改时不会被删除进行网格划分,因为它将用于历史记录?
答案 0 :(得分:0)
定义映射时,有一种方法可以告诉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: true