@@ -6,7 +6,7 @@ How to Use PdoSessionHandler to Store Sessions in the Database
6
6
7
7
.. caution ::
8
8
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
10
10
schema changed slightly. See :ref: `Symfony 2.6 Changes <pdo-session-handle-26-changes >`
11
11
for details.
12
12
@@ -118,10 +118,9 @@ a second array argument to ``PdoSessionHandler``:
118
118
.. code-block :: xml
119
119
120
120
<!-- app/config/config.xml -->
121
-
122
121
<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" >
125
124
<argument type =" service" id =" pdo" />
126
125
<argument type =" collection" >
127
126
<argument key =" db_table" >sessions</argument >
@@ -132,17 +131,22 @@ a second array argument to ``PdoSessionHandler``:
132
131
.. code-block :: php
133
132
134
133
// app/config/config.php
134
+
135
+ use Symfony\Component\DependencyInjection\Definition;
135
136
// ...
136
137
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
+ );
141
145
$container->setDefinition('session.handler.pdo', $storageDefinition);
142
146
143
147
.. 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.
146
150
147
151
The following things can be configured:
148
152
@@ -202,7 +206,7 @@ Example SQL Statements
202
206
203
207
.. sidebar :: Schema Changes needed when Upgrading to Symfony 2.6
204
208
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
206
210
need to make a few changes to your session table:
207
211
208
212
* A new session lifetime (``sess_lifetime `` by default) integer column
@@ -212,6 +216,10 @@ Example SQL Statements
212
216
213
217
Check the SQL statements below for more details.
214
218
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
+
215
223
MySQL
216
224
~~~~~
217
225
0 commit comments