Symfony 2 upgrade to 2.1: LogicException: Containe

2019-07-07 03:29发布

Just upgrading to Symfony 2.1. Been following the guides:

Everything seemed to go well, but now I keep getting the following exception

LogicException: Container extension "security" is not registered

I have compared my settings to the lastest available download of Symfony 2.1 and I can't see why the security extension is not registered. Can anyone help me out?

security.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' }

config.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%

2条回答
ゆ 、 Hurt°
2楼-- · 2019-07-07 03:45

It seems that the cached container configuration is at fault. I resolved this issue by running the following:

rm app/bootstrap.php.cache
composer install
查看更多
ゆ 、 Hurt°
3楼-- · 2019-07-07 03:53

it seems that your depedencies are broken,

Try to update you composer, and send me back an answer if it works

php composer.phar update
查看更多
登录 后发表回答