0

I am following the guide to install FOSUserBundle located at https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md

My security file:

security:
    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username_email

    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                csrf_provider: form.csrf_provider
            logout:       true
            anonymous:    true

    access_control:
        - { path: ^/admin/, role: ROLE_ADMIN }

however after doing all steps, I am getting one error:

ServiceNotFoundException: The service "security.authentication.manager" has a dependency on a non-existent service "fos_user.user_provider.username_email".

What could be causing it?

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57
dextervip
  • 4,999
  • 16
  • 65
  • 93
  • 1
    Have you activated the FOSUserBundle in the `AppKernel.php`? bundle is installed via composer and configured in config.yml? cache cleared? – Emii Khaos May 21 '13 at 21:09
  • @Pazi Yes I did as in the guide. Here are my other files https://gist.github.com/dextervip/5623298 Clear cache returns me the same error php app/console cache:clear [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] The service "security.authentication.manager" has a dependency on a non-existent service fos_user.user_provider.username_email". – dextervip May 21 '13 at 21:15
  • try with `fos_user.user_provider.username` for testing. – Emii Khaos May 21 '13 at 21:18
  • @Pazi It returns same error – dextervip May 21 '13 at 21:20

2 Answers2

4

You are using FOSUserBundle 1.0 which does not have the username_email provider. Upgrade to FOSUserBundle 2.0 by changing composer.json to: "friendsofsymfony/user-bundle": "dev-master",

The 2.0 version has plenty of good stuff in it including a bunch of useful events. Unfortunately, it has never been officially released as a stable version. Hence the dev-master version.

Cerad
  • 48,157
  • 8
  • 90
  • 92
0

Can't reproduce this. Maybe it's one of the magic "dependency service" error. Last time we got rid of this by deleting the whole vendor directory and the composer.lock file and rerun the composer update command. Maybe a try worth.

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57