7b02766373
Some explanations on how it works now: * The Session is an optional dependency of the Request. If you create the Request yourself (which is mandatory now in the front controller) and if you don't inject a Session yourself (which is recommended if you want the session to be configured via dependency injection), the Symfony2 Kernel will associate the Session configured in the Container with the Request automatically. * When duplicating a request, the session is shared between the parent and the child (that's because duplicated requests are sub-requests of the main one most of the time.) Notice that when you use ::create(), the behavior is the same as for the constructor; no session is attached to the Request. * Symfony2 tries hard to not create a session cookie when it is not needed but a Session object is always available (the cookie is only created when "something" is stored in the session.) * Symfony2 only starts a session when: * A session already exists in the request ($_COOKIE[session_name()] is defined -- this is done by RequestListener); * There is something written in the session object (the cookie will be sent to the Client). * Notice that reading from the session does not start the session anymore (as we don't need to start a new session to get the default values, and because if a session exists, it has already been started by RequestListener.)
55 lines
2.8 KiB
XML
Executable File
55 lines
2.8 KiB
XML
Executable File
<?xml version="1.0" ?>
|
|
|
|
<container xmlns="http://www.symfony-project.org/schema/dic/services"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
|
|
|
|
<parameters>
|
|
<parameter key="request_listener.class">Symfony\Bundle\FrameworkBundle\RequestListener</parameter>
|
|
<parameter key="controller_resolver.class">Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver</parameter>
|
|
<parameter key="controller_name_converter.class">Symfony\Bundle\FrameworkBundle\Controller\ControllerNameConverter</parameter>
|
|
<parameter key="response_listener.class">Symfony\Component\HttpKernel\ResponseListener</parameter>
|
|
<parameter key="exception_listener.class">Symfony\Component\HttpKernel\Debug\ExceptionListener</parameter>
|
|
<parameter key="exception_listener.controller">Symfony\Bundle\FrameworkBundle\Controller\ExceptionController::exceptionAction</parameter>
|
|
<parameter key="esi.class">Symfony\Component\HttpKernel\Cache\Esi</parameter>
|
|
<parameter key="esi_listener.class">Symfony\Component\HttpKernel\Cache\EsiListener</parameter>
|
|
</parameters>
|
|
|
|
<services>
|
|
<service id="controller_name_converter" class="%controller_name_converter.class%">
|
|
<argument type="service" id="kernel" />
|
|
<argument type="service" id="logger" on-invalid="ignore" />
|
|
</service>
|
|
|
|
<service id="controller_resolver" class="%controller_resolver.class%">
|
|
<argument type="service" id="service_container" />
|
|
<argument type="service" id="controller_name_converter" />
|
|
<argument type="service" id="logger" on-invalid="ignore" />
|
|
</service>
|
|
|
|
<service id="request_listener" class="%request_listener.class%">
|
|
<tag name="kernel.listener" />
|
|
<argument type="service" id="service_container" />
|
|
<argument type="service" id="router" />
|
|
<argument type="service" id="logger" on-invalid="ignore" />
|
|
</service>
|
|
|
|
<service id="esi" class="%esi.class%" />
|
|
|
|
<service id="esi_listener" class="%esi_listener.class%">
|
|
<tag name="kernel.listener" />
|
|
<argument type="service" id="esi" on-invalid="ignore" />
|
|
</service>
|
|
|
|
<service id="response_listener" class="%response_listener.class%">
|
|
<tag name="kernel.listener" />
|
|
</service>
|
|
|
|
<service id="exception_listener" class="%exception_listener.class%">
|
|
<tag name="kernel.listener" priority="128" />
|
|
<argument>%exception_listener.controller%</argument>
|
|
<argument type="service" id="logger" on-invalid="null" />
|
|
</service>
|
|
</services>
|
|
</container>
|