2012-02-23 130 views
2

我按照installation guide爲FOSUserBundle和上了步驟8以下錯誤:FOS用戶捆綁安裝錯誤

[Symfony的\元器件\ DependencyInjection \異常\ ServiceNotFoundException的]
ServiceNotFoundException的:服務「安全.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 

我應該手動註冊服務?如何進行?

+0

請提供您的security.yml – jstephenson 2012-02-23 15:20:34

+0

@jstephenson我已經把它添加到問題 – seferov 2012-02-23 15:27:38

回答

8

嘗試去除第二providers:塊(所以只是fos_userbundle一個保留)...

+0

出錯:InvalidConfigurationException:無法識別的選項「fos_userbundle」在「安全」下 – seferov 2012-02-23 15:43:49

+0

我的意思是從fos_userbundle上面刪除'providers:in_memory'塊,而不是'providers:',抱歉。 – jstephenson 2012-02-23 15:45:33

+0

對不起,我的壞:) – seferov 2012-02-23 15:49:22