3

只需升级到 Symfony 2.1。一直遵循指南:

一切似乎都很顺利,但现在我不断收到以下异常

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%
4

2 回答 2

4

似乎缓存的容器配置有问题。我通过运行以下命令解决了这个问题:

rm app/bootstrap.php.cache
composer install
于 2012-10-25T16:49:49.387 回答
2

看来你的依赖关系坏了,

尝试更新你的作曲家,如果可行,给我发回答案

php composer.phar update
于 2012-09-11T15:41:04.283 回答