Search code examples
symfonyvichuploaderbundlegaufrette

VichUploaderBundle an Gaufrette


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

Symfony 3

my config:

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

ERROR

[Symfony\Component\DependencyInjection\Exception\AutowiringFailedException]
Cannot autowire service "AppBundle\Twig\Base64Extension": argument "$storag
e" of method "__construct()" references interface "Vich\UploaderBundle\Stor
age\StorageInterface" but no such service exists. You should maybe alias th
is interface to one of these existing services: "vich_uploader.storage.file
_system", "vich_uploader.storage.gaufrette".


Solution

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