Symfony - 能够加载配置的扩展

Symfony - extension able to load the configuration

我正在尝试根据文档安装 FOSUserBundle

我在 conifig/packages 路径中创建了 fos_user.yaml 文件:

fos_user:
db_driver: orm
firewall_name: main
user_class: bundles\App\Base\Entity\User
from_email:
    address: "my@mail.com"
    sender_name: "Name Surname"
framework:
    translator: ~

但它一直抛出错误:

There is no extension able to load the configuration for "from_email" (in /
!! var/www/html/config/packages/fos_user.yaml). Looked for namespace "from_ema
!! il", found "framework", "sensio_framework_extra", "doctrine_cache", "doctri
!! ne", "doctrine_migrations", "maker", "security", "swiftmailer", "stof_doctr
!! ine_extensions", "doctrine_fixtures", "twig", "twig_extra", "fos_user"

我试过制作from_email.yaml但是没用。

您在 fos_user.yaml 文件中提供的配置缩进不正确。

如果您不缩进 fos_user 键下的值,Symfony 将尝试为每个值找到一个配置文件。

你应该这样写:

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: bundles\App\Base\Entity\User
    from_email:
        address: "my@mail.com"
        sender_name: "Name Surname"

更多详细信息,您可以查看完整的捆绑配置here