Unrecognized option "resource" under "fos_user"
Asked Answered
N

4

14

I am integrating FOSUserBundle in my application and I am trying to run php bin/console doctrine:migration:diff after following the recommended set-up.

I am systematically getting a:

In ArrayNode.php line 319:

  Unrecognized option "resource" under "fos_user"

Yet, I have set the following in my config/packages/routing.yaml:

framework:
    router:
        strict_requirements: ~

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"

What am I doing wrong? I have "friendsofsymfony/user-bundle": "~2.0" in my composer.json and ran composer update.

Update

My fos_user.yaml is:

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: App\Entity\Admin\User
    from_email:
        address: [email protected]
        sender_name: xxx
Niello answered 25/1, 2018 at 15:25 Comment(6)
can you show config.yml ?Telemark
I don't have any, since I have a Flex structure: #48445606Distribute
Have you tried to put the route config into config/routes.yaml instead of config/packages/routing.yaml?Calida
Aaaarrrgh... stupid me! If you create a solution, I'll approve it.Distribute
I think is because you din't enable your bundle in AppKernel with new FOS\UserBundle\FOSUserBundle(),Villainage
Hector: the bundle is enabled in /config/bundles.php. Dlondero's suggestion worked.Distribute
N
16

Dlondero's suggestion fixed the issue, the fos_user configuration should be set in config/routes.yaml.

From documentation, routes are never automatically added in configuration.

Niello answered 26/1, 2018 at 6:25 Comment(0)
H
6

If I am not wrong, config/packages/routing.yaml file is not for routes, it is the config file for routing bundle, you can not put your routing configs to there. Instead, you should put them under config/routes folder, as bundle_name.yml.

Like this, eg. config/routes/imagine.yml:

_liip_imagine:
    resource: "@LiipImagineBundle/Resources/config/routing.yaml"
Hejira answered 25/1, 2018 at 18:30 Comment(0)
B
6

move the :

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml" 

into config/routes.yaml insted of confing/packages/routing.yml

Bakehouse answered 11/6, 2018 at 9:39 Comment(0)
N
0

In my case with Symfony 4.3.2 skeleton

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml" 

should be pasted in

config/routes/annotations.yaml

and

php bin/console debug:router

displays all the fos_user routes

Nyaya answered 16/7, 2019 at 11:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.