VichUploaderBundle是一个Gaufrette

时间:2018-05-18 16:14:07

标签: symfony vichuploaderbundle gaufrette

"vich/uploader-bundle": "^1.4.2" and "knplabs/knp-gaufrette-bundle": "0.5"

Symfony 3

我的配置:

vich_uploader:
db_driver: orm
storage: gaufrette
mappings:
    customer_logo:
        uri_prefix:         /upload/customer_logos
        upload_destination: customer_logo_fs
        namer:              ~
        directory_namer:    vich_uploader.directory_namer_subdir
        inject_on_load:     false
        delete_on_update:   true
        delete_on_remove:   true

knp_gaufrette:
  stream_wrapper: ~
  adapters:
      user_photo:
        local:
            directory:  '%kernel.project_dir%/var/uploads/user/photos'
            create: true
  filesystems:
       customer_logo_fs:
           adapter: customer_logo_adapter

错误

[Symfony的\元器件\ DependencyInjection \异常\ AutowiringFailedException]
  无法自动服务" AppBundle \ Twig \ Base64Extension":参数" $ storag
  E"方法" __ construct()"引用接口" Vich \ UploaderBundle \ Stor
  年龄\ StorageInterface"但是没有这样的服务。你应该别名了   是这些现有服务之一的接口:" vich_uploader.storage.file
  _system"," vich_uploader.storage.gaufrette"。

1 个答案:

答案 0 :(得分:0)

    AppBundle\Twig\Base64Extension:
        arguments:  ['@vich_uploader.storage.gaufrette']
        public: true