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

相關問題