Skip to content

Commit 1e34823

Browse files
committed
Fixes thanks to comments and a new note about the LegacyPdoSessionHandler
1 parent 2f974bb commit 1e34823

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

cookbook/configuration/pdo_session_storage.rst

+19-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ How to Use PdoSessionHandler to Store Sessions in the Database
66

77
.. caution::
88

9-
There was a backwards-compatability break in Symfony 2.6: the database
9+
There was a backwards-compatibility break in Symfony 2.6: the database
1010
schema changed slightly. See :ref:`Symfony 2.6 Changes <pdo-session-handle-26-changes>`
1111
for details.
1212

@@ -118,10 +118,9 @@ a second array argument to ``PdoSessionHandler``:
118118
.. code-block:: xml
119119
120120
<!-- app/config/config.xml -->
121-
122121
<services>
123-
124-
<service id="session.handler.pdo" class="Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler">
122+
<service id="session.handler.pdo"
123+
class="Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler">
125124
<argument type="service" id="pdo" />
126125
<argument type="collection">
127126
<argument key="db_table">sessions</argument>
@@ -132,17 +131,22 @@ a second array argument to ``PdoSessionHandler``:
132131
.. code-block:: php
133132
134133
// app/config/config.php
134+
135+
use Symfony\Component\DependencyInjection\Definition;
135136
// ...
136137
137-
$storageDefinition = new Definition('Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler', array(
138-
new Reference('pdo'),
139-
array('db_table' => 'session')
140-
));
138+
$storageDefinition = new Definition(
139+
'Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler',
140+
array(
141+
new Reference('pdo'),
142+
array('db_table' => 'session')
143+
)
144+
);
141145
$container->setDefinition('session.handler.pdo', $storageDefinition);
142146
143147
.. versionadded:: 2.6
144-
The ``db_lifetime_col`` was introduced in Symfony 2.6 This column did
145-
not exist previously.
148+
The ``db_lifetime_col`` was introduced in Symfony 2.6. Prior to 2.6,
149+
this column did not exist.
146150

147151
The following things can be configured:
148152

@@ -202,7 +206,7 @@ Example SQL Statements
202206

203207
.. sidebar:: Schema Changes needed when Upgrading to Symfony 2.6
204208

205-
If you use the `PdoSessionHandler` prior to Symfony 2.6 and upgrade, you'll
209+
If you use the ``PdoSessionHandler`` prior to Symfony 2.6 and upgrade, you'll
206210
need to make a few changes to your session table:
207211

208212
* A new session lifetime (``sess_lifetime`` by default) integer column
@@ -212,6 +216,10 @@ Example SQL Statements
212216

213217
Check the SQL statements below for more details.
214218

219+
To keep the old (2.5 and earlier) functionality, change your class name
220+
to use ``LegacyPdoSessionHandler`` instead of ``PdoSessionHandler`` (the
221+
legacy class was added in Symfony 2.6.2).
222+
215223
MySQL
216224
~~~~~
217225

0 commit comments

Comments
 (0)