简体   繁体   English

FOSUser Bundle必须配置路径“fos_user”中的子节点“db_driver”

[英]FOSUser Bundle The child node “db_driver” at path “fos_user” must be configured

I am trying to update doctrine schema after installation FOSUser Bundle 2.0 but I keep getting this error: 我试图在安装FOSUser Bundle 2.0后更新doctrine架构,但我一直收到此错误:

In ArrayNode.php line 238:

The child node "db_driver" at path "fos_user" must be configured. 

File config.yaml is configurated propertly in location /config/config.yaml: 文件config.yaml在位置/config/config.yaml中配置属性:

framework:
translator: ~

fos_user:
db_driver: orm 
firewall_name: main
user_class: Entity\User
from_email:
    address: "%mailer_user%"
    sender_name: "%mailer_user%"

I tried to solve it via official tutorial: http://symfony.com/doc/master/bundles/FOSUserBundle/index.html#prerequisites 我尝试通过官方教程解决它: http//symfony.com/doc/master/bundles/FOSUserBundle/index.html#prerequisites

I tried to do step 5 first and than rerun step 1. But still the same error. 我尝试先执行第5步,然后重新运行第1步。但仍然是同样的错误。

Any ideas? 有任何想法吗?

In symfony 4.x you need to create a bundle_name.yaml file instead of config.yaml So, in this case create file fos_user.yaml in config/packages folder. 在symfony 4.x中,您需要创建一个bundle_name.yaml文件而不是config.yaml因此,在这种情况下,请在config / packages文件夹中创建文件fos_user.yaml。 In that file you place the configuration for FOSUserBundle, like so: 在该文件中,您可以放置​​FOSUserBundle的配置,如下所示:

fos_user:
db_driver: orm
firewall_name: main
user_class: Entity\User
from_email:
    address: '%env(resolve:USER_ADDRESS)%'
    sender_name: '%env(resolve:SENDER_NAME)%'
framework:
    templating:
        engines: ['twig', 'php']

Of course, defining the address and sender_name in .env file as constants or provide them directly with: "%mailer_user%" 当然,将.env文件中的address和sender_name定义为常量或直接提供它们:“%mailer_user%”

use composer require friendsofsymfony/user-bundle dev-master or go to their packagist page and get the latest version FOSUserBundle Packagist 使用composer require friendsofsymfony/user-bundle dev-master或转到他们的包装页面并获取最新版本FOSUserBundle Packagist

That should make it install without errors. 这应该使它安装没有错误。

If you need to figure out what has changed between symfony version 3.x and 4.xi suggest checking out this article: Configuration Structure - taken from symfony blog A new way to develop applications 如果你需要弄清楚symfony版本3.x和4.xi之间的变化,建议查看这篇文章: 配置结构 - 取自symfony blog 一种开发应用程序的新方法

try to indent like this: 试着像这样缩进:

fos_user:
    db_driver: orm 
    firewall_name: main
    user_class: Entity\User
    from_email:
        address: "%mailer_user%"
        sender_name: "%mailer_user%"

Because yml file needs to be written and indent well with all spaces necessary 因为需要编写yml文件并且缩进所有必要的空格

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM