FOS用户捆绑安装错误

时间:2012-02-23 14:20:49

标签: php symfony fosuserbundle

我已关注FOSUserBundle的installation guide并在步骤8中收到以下错误:

  

[Symfony的\元器件\ DependencyInjection \异常\ ServiceNotFoundException的]
  ServiceNotFoundException:服务“security.authentication.manager”依赖于不存在的服务“security.user.provider.concrete.fos_userbundle”。

这是我的security.yml:

# app/config/security.yml
security:
    providers:
        fos_userbundle:
            id: fos_user.user_manager

    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        FOS\UserBundle\Model\UserInterface:        sha512

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

    providers:
        in_memory:
            users:
                user:  { password: userpass, roles: [ 'ROLE_USER' ] }
                admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }

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

        login:
            pattern:  ^/demo/secured/login$
            security: false

        secured_area:
            pattern:    ^/demo/secured/
            form_login:
                check_path: /demo/secured/login_check
                login_path: /demo/secured/login
            logout:
                path:   /demo/secured/logout
                target: /demo/

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

    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/, role: ROLE_ADMIN }

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

我应该手动注册服务吗?怎么办?

1 个答案:

答案 0 :(得分:7)

尝试删除第二个providers:块(只剩下fos_userbundle个} ...