2015-08-15 84 views
3

下的Symfony 2(最新版本),我試圖更新我的實體:無法更新實體

php app/console doctrine:schema:upate --force 

我得到這個錯誤信息到我的終端:

[Symfony的\組件\配置\定義\異常\ InvalidConfigurationException]
無法識別的選項 「0,1,2,3」 下的 「security.firewalls.access_control」

我是Symfony中的新成員,我不知道在哪裏可以搜索來解決此問題。

這是security.yml文件:

# To get started with security, check out the documentation: 

http://symfony.com/doc/current/book/security.html

安全: 編碼器: FOS \ UserBundle \型號\的UserInterface:bcrypt

role_hierarchy: 
    ROLE_ADMIN:  ROLE_USER 
    ROLE_SUPER_ADMIN: ROLE_ADMIN 

# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers 
providers: 
    fos_userbundle: 
     id: fos_user.user_provider.username 

firewalls: 
    # disables authentication for assets and the profiler, adapt it according to your needs 
    main: 
     pattern: ^/ 
     form_login: 
      provider: fos_userbundle 
      csrf_provider: security.csrf.token_manager # Use form.csrf_provider instead for Symfony <2.4 

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

    #main: 
     #anonymous: ~ 
     # activate different ways to authenticate 

     # http_basic: ~ 
     # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate 

     # form_login: ~ 
     # http://symfony.com/doc/current/cookbook/security/form_login_setup.html 

    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 } 

回答

6
firewalls: 
    main: 
     pattern: ^/ 
     form_login: 
      provider: fos_userbundle 
      csrf_provider: security.csrf.token_manager # Use form.csrf_provider instead for Symfony <2.4 

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


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 } 
3

的錯誤不是與您嘗試更新您的實體有關但指向security.yml配置文件的問題。在這種情況下,access_control部分的縮進不正確,應與firewalls關鍵字的縮進級別相同。 YAML文件縮進敏感,所以這應該排序你的問題。

4

嘗試縮進ACCESS_CONTROL部分在使用防火牆同一水平