Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
537b8088
Commit
537b8088
authored
Mar 20, 2012
by
Dave Marshall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated docs to reflect session refactoring
parent
d1bd57d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
doc/cookbook/session_storage.rst
doc/cookbook/session_storage.rst
+6
-7
doc/providers/session.rst
doc/providers/session.rst
+6
-4
No files found.
doc/cookbook/session_storage.rst
View file @
537b8088
...
@@ -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 PdoSession
Storage
(
return new PdoSession
Handler
(
$app['pdo'],
$app['pdo'],
$app['pdo.db_options'],
$app['pdo.db_options'],
$app['session.storage.options']
$app['session.storage.options']
...
...
doc/providers/session.rst
View file @
537b8088
...
@@ -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
``NativeFileSession
Storage
``, defaults to the value of
``NativeFileSession
Handler
``, 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 ``Native
File
SessionStorage``, 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
-----------
-----------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment