HWIOAuthBundle 错误不存在的服务 "session"

HWIOAuthBundle error non-existent service "session"

我查看了所有内容,但找不到对此的引用:

配置 HWIOAuthBundle 并解决一些问题后,我收到以下错误:

 ( ! ) Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException' with message 'The service "hwi_oauth.resource_owner.google" has a dependency on a non-existent service "session".' in E:\Servidor\Wamp\wamp\www\DEVELOPMENT\magnetics\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass.php on line 64

我使用的是 Symfony 2.6,这是我的配置文件:

imports:
- { resource: parameters.yml }
- { resource: security.yml }

framework:
#esi:             ~
translator:      { fallback: %locale% }
secret:          %secret%
router:
    resource: "%kernel.root_dir%/config/routing.yml"
    strict_requirements: %kernel.debug%
form:            ~
csrf_protection: false
validation:      { enable_annotations: true }
templating:
    engines: ['twig']
    #assets_version: SomeVersionScheme
default_locale:  "%locale%"
trusted_proxies: ~
session:         false
fragments:       ~

hwi_oauth:
# name of the firewall in which this bundle is active, this setting MUST be set
firewall_name: secured_area

resource_owners:
    google:
        type:                google
        client_id:           "977681365085-3pb"
        client_secret:       "0IvhJ-DL7"
        scope:               "https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
        #options:
            #access_type:  offline

# Twig Configuration
twig:
debug:            %kernel.debug%
strict_variables: %kernel.debug%
exception_controller: 'FOS\RestBundle\Controller\ExceptionController::showAction'

# Assetic Configuration
assetic:
debug:          %kernel.debug%
use_controller: false
bundles:        [ MagneticsAdminBundle ]
#java: /usr/bin/java
filters:
    cssrewrite: ~
    #closure:
    #    jar: %kernel.root_dir%/Resources/java/compiler.jar
    #yui_css:
    #    jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar

# Doctrine Configuration
doctrine:
dbal:
    driver:   %database_driver%
    host:     %database_host%
    port:     %database_port%
    dbname:   %database_name%
    user:     %database_user%
    password: %database_password%
    charset:  UTF8
    # if using pdo_sqlite as your database driver, add the path in parameters.yml
    # e.g. database_path: %kernel.root_dir%/data/data.db3
    # path:     %database_path%

orm:
    auto_generate_proxy_classes: %kernel.debug%
    auto_mapping: true

# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host:      %mailer_host%
username:  %mailer_user%
password:  %mailer_password%
spool:     { type: memory }

sensio_framework_extra:
view: { annotations: false }

fos_rest:
disable_csrf_role: ROLE_API
param_fetcher_listener: true
view:
    mime_types:
        json: ['application/json', 'application/json;version=1.0', 'application/json;version=1.1']
    view_response_listener: 'force'
    formats:
        xml:  true
        json: true
    templating_formats:
        html: true
format_listener:
    rules:
        - { path: ^/, priorities: [ html, json, xml ], fallback_format: ~, prefer_extension: true }
    media_type:
        version_regex: '/(v|version)=(?P<version>[0-9\.]+)/'
exception:
    codes:
        'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
        'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
    messages:
        'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
allowed_methods_listener: true
access_denied_listener:
    json: true
body_listener: true

fos_http_cache:
cache_control:
    rules:
        # the controls section values are used in a call to Response::setCache();
        -
            match:
                path: ^/notes
                methods: [GET, HEAD]
            headers:
                cache_control: { public: true, max_age: 15, s_maxage: 30 }
                last_modified: "-1 hour"
                vary: [Accept-Encoding, Accept-Language]

我发现了类似的问题,但是 none 的解决方案对我有用,有人有想法吗?

您在配置中禁用了会话

session: false

我不确定,但我猜测当会话 disabled at the framework level.

时不会创建会话服务

可以通过调试容器来查看

$ php app/console container:debug

或更有针对性

$ php app/console container:debug session