@@ -43,6 +43,36 @@ configuration format of your choice):
43
43
user : myuser
44
44
password : mypassword
45
45
46
+ .. code-block :: xml
47
+
48
+ <!-- app/config/config.xml -->
49
+ <framework : config >
50
+ <framework : session storage-id =" session.storage.pdo" default-locale =" en" lifetime =" 3600" auto-start =" true" />
51
+ </framework : config >
52
+
53
+ <parameters >
54
+ <parameter key =" pdo.db_options" type =" collection" >
55
+ <parameter key =" db_table" >session</parameter >
56
+ <parameter key =" db_id_col" >session_id</parameter >
57
+ <parameter key =" db_data_col" >session_value</parameter >
58
+ <parameter key =" db_time_col" >session_time</parameter >
59
+ </parameter >
60
+ <parameter key =" pdo.options" />
61
+ </parameters >
62
+
63
+ <services >
64
+ <service id =" pdo" class =" PDO" >
65
+ <argument id =" dsn" >mysql:dbname=sf2demo</argument >
66
+ <argument id =" user" >root</argument >
67
+ <argument id =" password" >password</argument >
68
+ </service >
69
+
70
+ <service id =" session.storage.pdo" class =" Symfony\Component\HttpFoundation\SessionStorage\PdoSessionStorage" >
71
+ <argument type =" service" id =" pdo" />
72
+ <argument >%pdo.db_options%</argument >
73
+ <argument >%pdo.options%</argument >
74
+ </service >
75
+ </services >
46
76
47
77
* ``db_table ``: The name of the session table in your database
48
78
* ``db_id_col ``: The name of the id column in your session table (VARCHAR(255) or larger)
@@ -71,6 +101,14 @@ parameter.ini by referencing the database-related parameters defined there:
71
101
user : %database_user%
72
102
password : %database_password%
73
103
104
+ .. code-block :: xml
105
+
106
+ <service id =" pdo" class =" PDO" >
107
+ <argument id =" dsn" >mysql:dbname=%database_name%</argument >
108
+ <argument id =" user" >%database_user%</argument >
109
+ <argument id =" password" >%database_password%</argument >
110
+ </service >
111
+
74
112
Example MySQL Statement
75
113
-----------------------
76
114
0 commit comments