Search code examples
symfonyconfigurationmappingvichuploaderbundle

VichUploaderBundle with symfony 4: no extension able to load the configuration for "mappings"


I'm trying to use VichUploaderBundle to handle a file upload. I work with symfony 4. I have a problem in the first step (Step 1: configure an upload mapping).

in the app/config/config.yml file I have:

vich_uploader:
    db_driver: orm

mappings:
    property_image:
        uri_prefix: /images/properties
        upload_destination: '%kernel.project_dir%/public/images/properties'

But it creates an error:

(2/2) FileLoaderLoadException There is no extension able to load the configuration for "mappings" (in C:\wamp64\www\MonAgence\config/packages/vich_uploader.yaml). Looked for namespace "mappings", found "framework", "sensio_framework_extra", "doctrine_cache", "doctrine", "doctrine_migrations", "security", "swiftmailer", "web_profiler", "twig", "monolog", "debug", "maker", "web_server", "doctrine_fixtures", "knp_paginator", "vich_uploader" in C:\wamp64\www\MonAgence\config/packages/vich_uploader.yaml (which is loaded in resource "C:\wamp64\www\MonAgence\config/packages/vich_uploader.yaml").

I searched the internet but I don't see how to fix it. Do you have an idea?


Solution

  • it works without the line break.

    vich_uploader:
        db_driver: orm
        mappings:
            property_image:
                uri_prefix: /images/properties
                upload_destination: '%kernel.project_dir%/public/images/properties'