Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

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:

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

I tried to do step 5 first and than rerun step 1. But still the same error.

Any ideas?

like image 944
Václav Stummer Avatar asked Dec 08 '22 15:12

Václav Stummer


2 Answers

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. In that file you place the configuration for FOSUserBundle, like so:

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%"

use composer require friendsofsymfony/user-bundle dev-master or go to their packagist page and get the latest version 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.x i suggest checking out this article: Configuration Structure - taken from symfony blog A new way to develop applications

like image 154
George Milojevic Avatar answered Dec 10 '22 21:12

George Milojevic


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

like image 26
Alessandro Minoccheri Avatar answered Dec 10 '22 23:12

Alessandro Minoccheri