Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The configuration names have been changed to avoid confusion (user was ambiguous) Before: <app:user default_locale="fr"> <app:session name="SYMFONY" type="Native" lifetime="3600" /> </app:user> After: <app:session default_locale="fr" name="SYMFONY" storage_id="native" lifetime="3600" />
- Loading branch information
Showing
4 changed files
with
25 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,8 +111,8 @@ public function configLoad($config, ContainerBuilder $container) | |
$this->registerTestConfiguration($config, $container); | ||
} | ||
|
||
if (isset($config['user'])) { | ||
$this->registerUserConfiguration($config, $container); | ||
if (isset($config['session'])) { | ||
$this->registerSessionConfiguration($config, $container); | ||
} | ||
|
||
$this->registerTranslatorConfiguration($config, $container); | ||
|
@@ -303,9 +303,9 @@ protected function registerTranslatorConfiguration($config, ContainerBuilder $co | |
* @param array $config A configuration array | ||
* @param ContainerBuilder $container A ContainerBuilder instance | ||
*/ | ||
protected function registerUserConfiguration($config, ContainerBuilder $container) | ||
protected function registerSessionConfiguration($config, ContainerBuilder $container) | ||
{ | ||
$config = $config['user']; | ||
$config = $config['session']; | ||
|
||
if (!$container->hasDefinition('session')) { | ||
$loader = new XmlFileLoader($container, array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config')); | ||
|
@@ -322,20 +322,19 @@ protected function registerUserConfiguration($config, ContainerBuilder $containe | |
$container->setParameter('session.class', $config['class']); | ||
} | ||
|
||
foreach (array('name', 'lifetime', 'path', 'domain', 'secure', 'httponly', 'cache_limiter', 'cache-limiter', 'pdo.db_table') as $name) { | ||
if (isset($config['session'][$name])) { | ||
$container->setParameter('session.options.'.$name, $config['session'][$name]); | ||
} | ||
if (isset($config['storage_id'])) { | ||
$container->setAlias('session.storage', 'session.storage.'.$config['storage_id']); | ||
} else { | ||
$config['storage_id'] = 'native'; | ||
} | ||
|
||
if (isset($config['session']['class'])) { | ||
$class = $config['session']['class']; | ||
if (in_array($class, array('Native', 'Pdo'))) { | ||
$class = 'Symfony\\Component\\HttpFoundation\\SessionStorage\\'.$class.'SessionStorage'; | ||
$options = $container->getParameter('session.storage.'.strtolower($config['storage_id']).'.options'); | ||
foreach (array('name', 'lifetime', 'path', 'domain', 'secure', 'httponly', 'cache_limiter', 'cache-limiter', 'pdo.db_table') as $name) { | ||
if (isset($config['session'][$name])) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
$options[$name] = $config['session'][$name]; | ||
} | ||
|
||
$container->setParameter('session.session', 'session.session.'.strtolower($class)); | ||
} | ||
$container->setParameter('session.storage.'.strtolower($config['storage_id']).'.options', $options); | ||
This comment has been minimized.
Sorry, something went wrong.
tecbot
|
||
} | ||
|
||
protected function registerRouterConfiguration($config, ContainerBuilder $container) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isset($config['session'][$name])) => if (isset($config[$name]))
and
$options[$name] = $config['session'][$name]; => $options[$name] = $config[$name];
see line 308