0

我有一个使用 EasyAdminBundle 进行管理的项目。在一个名为“Post”的实体中,我有字段“title”、“image”和“post”,我想跟踪它们的变化。属性“image”仅存储图像的文件名 - 完整的上传过程由 VichUploaderBundle 管理。

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

4

1 回答 1

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
于 2016-02-12T07:57:09.083 回答