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,
because databases are easier to use and scale in a multi-webserver
environment.
Symfony2 has multiple session storage solutions and one of them uses PDO to
store sessions, `PdoSessionStorage
<http://api.symfony.com/master/Symfony/Component/HttpFoundation/Session/Storage/PdoSessionStorage.html>
To use it, replace the ``session.storage`` service in your application like
Symfony2's ``NativeSessionStorage`` has multiple storage handlers and one of them uses PDO to
store sessions, ``PdoSessionHandler``.
To use it, replace the ``session.storage.handler`` service in your application like
explained below.
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());
......@@ -41,8 +40,8 @@ Example
);
});
$app['session.storage'] = $app->share(function () use ($app) {
return new PdoSessionStorage(
$app['session.storage.handler'] = $app->share(function () use ($app) {
return new PdoSessionHandler(
$app['pdo'],
$app['pdo.db_options'],
$app['session.storage.options']
......
......@@ -8,13 +8,13 @@ Parameters
----------
* **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()``.
* **session.storage.options**: An array of options that is passed to the
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)
* **id**: The session id (null by default)
......@@ -34,8 +34,10 @@ Services
<http://api.symfony.com/master/Symfony/Component/HttpFoundation/Session/Session.html>`_.
* **session.storage**: A service that is used for persistence of the
session data. Defaults to a `NativeFileSessionStorage
<http://api.symfony.com/master/Symfony/Component/HttpFoundation/Session/Storage/NativeFileSessionStorage.html>`_.
session data. Defaults to a ``NativeSessionStorage``
* **session.storage.handler**: A service that is used by the ``session.storage``
for data access. Defaults to a ``NativeFileSessionHandler`` storage handler.
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