Commit 9a8858f6 authored by Fabien Potencier's avatar Fabien Potencier

merged branch stof/patch-3 (PR #168)

Commits
-------

cf72c220 Updated the doc for the SessionExtension
a8dfaed8 Made the default locale configurable

Discussion
----------

Made the default locale configurable

Implements the feature request by @lyrrix: https://twitter.com/#!/lyrixx/status/112489647938080768
parents b8f52737 cf72c220
...@@ -7,6 +7,8 @@ between requests. ...@@ -7,6 +7,8 @@ between requests.
Parameters Parameters
---------- ----------
* **session.default_locale**: The locale used by default in the session.
* **session.storage.options**: An array of options that is passed to the * **session.storage.options**: An array of options that is passed to the
constructor of the ``session.storage`` service. constructor of the ``session.storage`` service.
......
...@@ -32,7 +32,7 @@ class SessionExtension implements ExtensionInterface ...@@ -32,7 +32,7 @@ class SessionExtension implements ExtensionInterface
$this->app = $app; $this->app = $app;
$app['session'] = $app->share(function () use ($app) { $app['session'] = $app->share(function () use ($app) {
return new Session($app['session.storage']); return new Session($app['session.storage'], $app['session.default_locale']);
}); });
$app['session.storage'] = $app->share(function () use ($app) { $app['session.storage'] = $app->share(function () use ($app) {
...@@ -44,6 +44,10 @@ class SessionExtension implements ExtensionInterface ...@@ -44,6 +44,10 @@ class SessionExtension implements ExtensionInterface
if (!isset($app['session.storage.options'])) { if (!isset($app['session.storage.options'])) {
$app['session.storage.options'] = array(); $app['session.storage.options'] = array();
} }
if (!isset($app['session.default_locale'])) {
$app['session.default_locale'] = 'en';
}
} }
public function onKernelRequest($event) public function onKernelRequest($event)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment