【问题标题】:Symfony FOSUser Bundle error The child node "db_driver" at path "fos_user" must be configuredSymfony FOSUser Bundle错误必须配置路径“fos_user”处的子节点“db_driver”
【发布时间】:2016-09-29 11:03:57
【问题描述】:

我刚刚安装了 FOSUser 包并在运行时在AppKernelregistereBundles() 函数中对其进行了初始化

console cache:clear

得到

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException] 必须配置路径“fos_user”的子节点“db_driver”。

我的理解是,除非或直到我不使用捆绑软件,否则它不应干扰应用程序流程。我想知道为什么到目前为止我没有对 FOSUserBundle 做任何事情时会遇到这个问题

【问题讨论】:

标签: symfony fosuserbundle


【解决方案1】:

您必须在 config.yml 中添加主要数据。

# FOSUser
fos_user:
    db_driver: orm
    firewall_name: main
    user_class: UserBundle\Entity\User

这是ORM的配置。

【讨论】:

  • 好吧,我不想补充,这不是与面向服务的架构相矛盾吗?为什么它强迫我首先这样做。请原谅我不是粗鲁,只是了解服务是否应该像这样运行。我认为它只在需要时才加载。
  • 它需要它,因为您在 AppKernel 中注册了 bundle。当你这样做时,它会创建对象,然后初始化例如服务。
  • 你是对的,文档:symfony.com/doc/current/bundles/FOSUserBundle/index.html 在第一步中说得对If you encounter installation errors pointing at a lack of configuration parameters, such as The child node "db_driver" at path "fos_user" must be configured, you should complete the configuration in Step 5 first and then re-run this step.
【解决方案2】:

尝试通过在终端中运行“composer update”来更新您的 composer.json 文件。我通过更新解决了类似的错误。愿这有帮助。

【讨论】:

    【解决方案3】:

    添加邮件用户和邮件密码

    进行以下更改以消除错误

    parameters.yml

    参数: mailer_user:空 mailer_password: null

    【讨论】:

      猜你喜欢
      • 2018-08-08
      • 1970-01-01
      • 1970-01-01
      • 2019-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-04
      • 2018-08-07
      相关资源
      最近更新 更多