带有 symfony 4 的 VichUploaderBundle:没有扩展能够加载 "mappings" 的配置
VichUploaderBundle with symfony 4: no extension able to load the configuration for "mappings"
我正在尝试使用 VichUploaderBundle 处理文件上传。我使用 symfony 4。
第一步有问题(第一步:配置上传映射)
在 app/config/config.yml 文件中我有:
vich_uploader:
db_driver: orm
mappings:
property_image:
uri_prefix: /images/properties
upload_destination: '%kernel.project_dir%/public/images/properties'
但它会产生一个错误:
(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").
我在互联网上进行了搜索,但没有找到解决方法。
你有什么想法吗?
知道了,
你的包加载正常,在你的错误中指定它是因为它查找
的配置
"vich_uploader"
问题来自
"mappings"
不存在。
mapping
是 vich_uploader
配置的一部分,因此它应该像这样在内部缩进:
vich_uploader:
db_driver: orm
mappings:
property_image:
uri_prefix: /images/properties
upload_destination: '%kernel.project_dir%/public/images/properties'
它没有换行符。
vich_uploader:
db_driver: orm
mappings:
property_image:
uri_prefix: /images/properties
upload_destination: '%kernel.project_dir%/public/images/properties'
我正在尝试使用 VichUploaderBundle 处理文件上传。我使用 symfony 4。 第一步有问题(第一步:配置上传映射)
在 app/config/config.yml 文件中我有:
vich_uploader:
db_driver: orm
mappings:
property_image:
uri_prefix: /images/properties
upload_destination: '%kernel.project_dir%/public/images/properties'
但它会产生一个错误:
(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").
我在互联网上进行了搜索,但没有找到解决方法。 你有什么想法吗?
知道了,
你的包加载正常,在你的错误中指定它是因为它查找
的配置"vich_uploader"
问题来自
"mappings"
不存在。
mapping
是 vich_uploader
配置的一部分,因此它应该像这样在内部缩进:
vich_uploader:
db_driver: orm
mappings:
property_image:
uri_prefix: /images/properties
upload_destination: '%kernel.project_dir%/public/images/properties'
它没有换行符。
vich_uploader: db_driver: orm mappings: property_image: uri_prefix: /images/properties upload_destination: '%kernel.project_dir%/public/images/properties'