只需升级到 Symfony 2.1。一直遵循指南:
- https://github.com/symfony/symfony-standard/blob/master/UPGRADE.md
- https://github.com/symfony/symfony/blob/master/UPGRADE-2.1.md
一切似乎都很顺利,但现在我不断收到以下异常
LogicException:容器扩展“安全”未注册
我已将我的设置与 Symfony 2.1 的最新可用下载进行了比较,但我不明白为什么没有注册安全扩展。谁能帮我吗?
安全.yml
jms_security_extra:
secure_all_services: false
expressions: true
security:
encoders:
Steve\MyBundle\Entity\UserToken:
algorithm: sha512
role_hierarchy:
ROLE_GUEST:
ROLE_USER: ROLE_GUEST
ROLE_ADMIN: ROLE_USER
providers:
default:
id: steve_my_bundle.security.provider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
anonymous: ~
form_login:
login_path: /login
check_path: /login_check
logout:
path: /logout
target: /
access_control:
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/static, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/about, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin, roles: 'ROLE_ADMIN' }
- { path: ^/, roles: 'ROLE_USER' }
配置.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#esi: ~
#translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: %kernal.debug%
form: true
csrf_protection: true
validation: { enable_annotations: true }
templating: { engines: ['twig','php'] } #assets_version: SomeVersionScheme
default_locale: %locale%
trust_proxy_headers: false
session:
auto_start: ~
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
# Assetic Configuration
assetic:
bundles: []
debug: %kernel.debug%
use_controller: false
# java: /usr/bin/java
filters:
cssrewrite: ~
# closure:
# jar: %kernel.root_dir%/java/compiler.jar
# yui_css:
# jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar
# Doctrine Configuration
doctrine:
dbal:
default_connection: default
connections:
default:
driver: %ownd_source_pwnd_database_driver%
host: %ownd_source_pwnd_database_host%
port: %ownd_source_pwnd_database_port%
dbname: %ownd_source_pwnd_database_name%
user: %ownd_source_pwnd_database_user%
password: %ownd_source_pwnd_database_password%
charset: UTF8
unix_socket: /tmp/mysql.sock
orm:
#auto_mapping: false
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
SteveMyBundleBundle: ~
# Swiftmailer Configuration
swiftmailer:
spool: { type: memory }
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%