1
"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\Component\DependencyInjection\Exception\AutowiringFailedException]
无法自动装配服务“AppBundle\Twig\Base64Extension”:
方法“__construct()”的参数“$storag e”引用接口“Vich\UploaderBundle\Storage
\StorageInterface”但没有服务存在。您可能应该将其别名
为这些现有服务之一的接口:“vich_uploader.storage.file
_system”、“vich_uploader.storage.gaufrette”。

4

1 回答 1

0

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

于 2018-05-22T11:45:32.970 回答