无法更新实体
Impossible to update Entity
在 Symfony 2(最新版本)下,我正在尝试更新我的实体:
php app/console doctrine:schema:upate --force
我的终端收到这条错误消息:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized options "0, 1, 2, 3" under "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\Model\UserInterface: 加密
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 }
该错误与您尝试更新实体无关,而是指向 security.yml
配置文件的问题。在这种情况下,access_control
部分的缩进不正确,应该与 firewalls
关键字处于同一缩进级别。 YAML 文件对缩进敏感,因此这应该可以解决您的问题。
尝试缩进 access_control 与防火墙处于同一级别的部分
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 }
在 Symfony 2(最新版本)下,我正在尝试更新我的实体:
php app/console doctrine:schema:upate --force
我的终端收到这条错误消息:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized options "0, 1, 2, 3" under "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\Model\UserInterface: 加密
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 }
该错误与您尝试更新实体无关,而是指向 security.yml
配置文件的问题。在这种情况下,access_control
部分的缩进不正确,应该与 firewalls
关键字处于同一缩进级别。 YAML 文件对缩进敏感,因此这应该可以解决您的问题。
尝试缩进 access_control 与防火墙处于同一级别的部分
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 }