[FrameworkBundle] Remove 'auto_start' configuration parameter.
This commit is contained in:
parent
8ebe624b82
commit
1fd66f3cdf
@ -32,3 +32,5 @@ CHANGELOG
|
|||||||
`gc_probability`/`gc_divisor` chance of being run. The `gc_maxlifetime` defines
|
`gc_probability`/`gc_divisor` chance of being run. The `gc_maxlifetime` defines
|
||||||
how long a session can idle for. It is different from cookie lifetime which
|
how long a session can idle for. It is different from cookie lifetime which
|
||||||
declares how long a cookie can be stored on the remote client.
|
declares how long a cookie can be stored on the remote client.
|
||||||
|
* Removed 'auto_start' configuration parameter from session config. The session will
|
||||||
|
start on demand.
|
||||||
|
@ -176,7 +176,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
->info('session configuration')
|
->info('session configuration')
|
||||||
->canBeUnset()
|
->canBeUnset()
|
||||||
->children()
|
->children()
|
||||||
->booleanNode('auto_start')->defaultFalse()->end()
|
->booleanNode('auto_start')->info('DEPRECATED! Session wil start on demand')->end()
|
||||||
->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
|
->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
|
||||||
->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()
|
->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()
|
||||||
->scalarNode('name')->end()
|
->scalarNode('name')->end()
|
||||||
|
@ -291,13 +291,10 @@ class FrameworkExtension extends Extension
|
|||||||
{
|
{
|
||||||
$loader->load('session.xml');
|
$loader->load('session.xml');
|
||||||
|
|
||||||
// session
|
|
||||||
$container->getDefinition('session_listener')->addArgument($config['auto_start']);
|
|
||||||
|
|
||||||
// session storage
|
// session storage
|
||||||
$container->setAlias('session.storage', $config['storage_id']);
|
$container->setAlias('session.storage', $config['storage_id']);
|
||||||
$options = array();
|
$options = array();
|
||||||
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'auto_start', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
|
foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
|
||||||
if (isset($config[$key])) {
|
if (isset($config[$key])) {
|
||||||
$options[$key] = $config[$key];
|
$options[$key] = $config[$key];
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,6 @@ class SessionListener implements EventSubscriberInterface
|
|||||||
public function __construct(ContainerInterface $container, $autoStart = false)
|
public function __construct(ContainerInterface $container, $autoStart = false)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
$this->autoStart = $autoStart;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onKernelRequest(GetResponseEvent $event)
|
public function onKernelRequest(GetResponseEvent $event)
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
$container->loadFromExtension('framework', array(
|
$container->loadFromExtension('framework', array(
|
||||||
'secret' => 's3cr3t',
|
'secret' => 's3cr3t',
|
||||||
'session' => array(
|
'session' => array(
|
||||||
'auto_start' => true,
|
|
||||||
'storage_id' => 'session.storage.native',
|
'storage_id' => 'session.storage.native',
|
||||||
'handler_id' => 'session.handler.native_file',
|
'handler_id' => 'session.handler.native_file',
|
||||||
'name' => '_SYMFONY',
|
'name' => '_SYMFONY',
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
$container->loadFromExtension('framework', array(
|
$container->loadFromExtension('framework', array(
|
||||||
'secret' => 's3cr3t',
|
'secret' => 's3cr3t',
|
||||||
'session' => array(
|
'session' => array(
|
||||||
'auto_start' => true,
|
|
||||||
'storage_id' => 'session.storage.native',
|
'storage_id' => 'session.storage.native',
|
||||||
'handler_id' => 'session.handler.native_file',
|
'handler_id' => 'session.handler.native_file',
|
||||||
'name' => '_SYMFONY',
|
'name' => '_SYMFONY',
|
||||||
|
@ -19,7 +19,6 @@ $container->loadFromExtension('framework', array(
|
|||||||
'type' => 'xml',
|
'type' => 'xml',
|
||||||
),
|
),
|
||||||
'session' => array(
|
'session' => array(
|
||||||
'auto_start' => true,
|
|
||||||
'storage_id' => 'session.storage.native',
|
'storage_id' => 'session.storage.native',
|
||||||
'handler_id' => 'session.handler.native_file',
|
'handler_id' => 'session.handler.native_file',
|
||||||
'name' => '_SYMFONY',
|
'name' => '_SYMFONY',
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
framework:
|
framework:
|
||||||
secret: s3cr3t
|
secret: s3cr3t
|
||||||
session:
|
session:
|
||||||
auto_start: true
|
|
||||||
storage_id: session.storage.native
|
storage_id: session.storage.native
|
||||||
handler_id: session.handler.native_file
|
handler_id: session.handler.native_file
|
||||||
name: _SYMFONY
|
name: _SYMFONY
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
framework:
|
framework:
|
||||||
secret: s3cr3t
|
secret: s3cr3t
|
||||||
session:
|
session:
|
||||||
auto_start: true
|
|
||||||
storage_id: session.storage.native
|
storage_id: session.storage.native
|
||||||
handler_id: session.handler.native_file
|
handler_id: session.handler.native_file
|
||||||
name: _SYMFONY
|
name: _SYMFONY
|
||||||
|
@ -13,7 +13,6 @@ framework:
|
|||||||
resource: %kernel.root_dir%/config/routing.xml
|
resource: %kernel.root_dir%/config/routing.xml
|
||||||
type: xml
|
type: xml
|
||||||
session:
|
session:
|
||||||
auto_start: true
|
|
||||||
storage_id: session.storage.native
|
storage_id: session.storage.native
|
||||||
handler_id: session.handler.native_file
|
handler_id: session.handler.native_file
|
||||||
name: _SYMFONY
|
name: _SYMFONY
|
||||||
|
@ -77,7 +77,6 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
|
|
||||||
$this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml');
|
$this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml');
|
||||||
$this->assertEquals('fr', $container->getParameter('kernel.default_locale'));
|
$this->assertEquals('fr', $container->getParameter('kernel.default_locale'));
|
||||||
$this->assertTrue($container->getDefinition('session_listener')->getArgument(1));
|
|
||||||
$this->assertEquals('session.storage.native', (string) $container->getAlias('session.storage'));
|
$this->assertEquals('session.storage.native', (string) $container->getAlias('session.storage'));
|
||||||
$this->assertEquals('session.handler.native_file', (string) $container->getAlias('session.handler'));
|
$this->assertEquals('session.handler.native_file', (string) $container->getAlias('session.handler'));
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ class SessionHelperTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->request = new Request();
|
$this->request = new Request();
|
||||||
|
|
||||||
$session = new Session(new MockArraySessionStorage());
|
$session = new Session(new MockArraySessionStorage());
|
||||||
|
$session->start();
|
||||||
$session->set('foobar', 'bar');
|
$session->set('foobar', 'bar');
|
||||||
$session->getFlashBag()->set('notice', 'bar');
|
$session->getFlashBag()->set('notice', 'bar');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user