0

我有一个使用EasyAdminBundle进行管理的项目。在一个名为“发布”的实体中,我有“标题”,“图片”和“发布”字段,我希望跟踪有关更改。属性“image”只存储​​图像的文件名 - 完整的上传过程由VichUploaderBundle管理。Symfony2:EasyAdminbundle + StofDoctrineExtensionsBundle + VichUploaderBundle

如何/我在哪里可以筛选旧图像文件在更改时不会被删除,因为它将用于历史记录?

回答

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 
+0

谢谢您为你的帮助 - 我认为这将工作:) – nPoday

相关问题