Commit 537b8088 authored by Dave Marshall's avatar Dave Marshall

Updated docs to reflect session refactoring

parent d1bd57d1
...@@ -7,10 +7,9 @@ medium to large websites use a database to store sessions instead of files, ...@@ -7,10 +7,9 @@ medium to large websites use a database to store sessions instead of files,
because databases are easier to use and scale in a multi-webserver because databases are easier to use and scale in a multi-webserver
environment. environment.
Symfony2 has multiple session storage solutions and one of them uses PDO to Symfony2's ``NativeSessionStorage`` has multiple storage handlers and one of them uses PDO to
store sessions, `PdoSessionStorage store sessions, ``PdoSessionHandler``.
<http://api.symfony.com/master/Symfony/Component/HttpFoundation/Session/Storage/PdoSessionStorage.html> To use it, replace the ``session.storage.handler`` service in your application like
To use it, replace the ``session.storage`` service in your application like
explained below. explained below.
Example Example
...@@ -18,7 +17,7 @@ Example ...@@ -18,7 +17,7 @@ Example
:: ::
use Symfony\Component\HttpFoundation\Session\Storage\PdoSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
$app->register(new Silex\Provider\SessionServiceProvider()); $app->register(new Silex\Provider\SessionServiceProvider());
...@@ -41,8 +40,8 @@ Example ...@@ -41,8 +40,8 @@ Example
); );
}); });
$app['session.storage'] = $app->share(function () use ($app) { $app['session.storage.handler'] = $app->share(function () use ($app) {
return new PdoSessionStorage( return new PdoSessionHandler(
$app['pdo'], $app['pdo'],
$app['pdo.db_options'], $app['pdo.db_options'],
$app['session.storage.options'] $app['session.storage.options']
......
...@@ -8,13 +8,13 @@ Parameters ...@@ -8,13 +8,13 @@ Parameters
---------- ----------
* **session.storage.save_path** (optional): The path for the * **session.storage.save_path** (optional): The path for the
``NativeFileSessionStorage``, defaults to the value of ``NativeFileSessionHandler``, defaults to the value of
``sys_get_temp_dir()``. ``sys_get_temp_dir()``.
* **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.
In case of the default ``NativeFileSessionStorage``, the possible options are: In case of the default ``NativeSessionStorage``, the possible options are:
* **name**: The cookie name (_SESS by default) * **name**: The cookie name (_SESS by default)
* **id**: The session id (null by default) * **id**: The session id (null by default)
...@@ -34,8 +34,10 @@ Services ...@@ -34,8 +34,10 @@ Services
<http://api.symfony.com/master/Symfony/Component/HttpFoundation/Session/Session.html>`_. <http://api.symfony.com/master/Symfony/Component/HttpFoundation/Session/Session.html>`_.
* **session.storage**: A service that is used for persistence of the * **session.storage**: A service that is used for persistence of the
session data. Defaults to a `NativeFileSessionStorage session data. Defaults to a ``NativeSessionStorage``
<http://api.symfony.com/master/Symfony/Component/HttpFoundation/Session/Storage/NativeFileSessionStorage.html>`_.
* **session.storage.handler**: A service that is used by the ``session.storage``
for data access. Defaults to a ``NativeFileSessionHandler`` storage handler.
Registering Registering
----------- -----------
......
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