1
1
<?php
2
2
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
3
12
namespace Symfony \Bridge \Doctrine \HttpFoundation ;
4
13
5
14
use Doctrine \DBAL \Platforms \MySqlPlatform ;
6
- use Symfony \Component \HttpFoundation \Session \Storage \AbstractSessionStorage ;
7
15
use Doctrine \DBAL \Driver \Connection ;
8
16
9
17
/**
12
20
* @author Fabien Potencier <fabien@symfony.com>
13
21
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
14
22
*/
15
- class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandlerInterface
23
+ class DbalSessionHandler implements \SessionHandlerInterface
16
24
{
17
25
/**
18
26
* @var Connection
@@ -25,36 +33,27 @@ class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandl
25
33
private $ tableName ;
26
34
27
35
/**
36
+ * Constructor.
28
37
*
29
- * @param Connection $con An instance of Connection.
30
- * @param string $tableName Table name.
31
- * @param array $options Session configuration options
38
+ * @param Connection $con An instance of Connection.
39
+ * @param string $tableName Table name.
32
40
*/
33
- public function __construct (Connection $ con , $ tableName = 'sessions ' , array $ options = array () )
41
+ public function __construct (Connection $ con , $ tableName = 'sessions ' )
34
42
{
35
43
$ this ->con = $ con ;
36
44
$ this ->tableName = $ tableName ;
37
-
38
- parent ::__construct ($ options );
39
45
}
40
46
41
47
/**
42
- * Opens a session.
43
- *
44
- * @param string $path (ignored)
45
- * @param string $name (ignored)
46
- *
47
- * @return Boolean true, if the session was opened, otherwise an exception is thrown
48
+ * {@inheritdoc}
48
49
*/
49
50
public function open ($ path = null , $ name = null )
50
51
{
51
52
return true ;
52
53
}
53
54
54
55
/**
55
- * Closes a session.
56
- *
57
- * @return Boolean true, if the session was closed, otherwise false
56
+ * {@inheritdoc}
58
57
*/
59
58
public function close ()
60
59
{
@@ -63,13 +62,7 @@ public function close()
63
62
}
64
63
65
64
/**
66
- * Destroys a session.
67
- *
68
- * @param string $id A session ID
69
- *
70
- * @return Boolean true, if the session was destroyed, otherwise an exception is thrown
71
- *
72
- * @throws \RuntimeException If the session cannot be destroyed
65
+ * {@inheritdoc}
73
66
*/
74
67
public function destroy ($ id )
75
68
{
@@ -85,13 +78,7 @@ public function destroy($id)
85
78
}
86
79
87
80
/**
88
- * Cleans up old sessions.
89
- *
90
- * @param int $lifetime The lifetime of a session
91
- *
92
- * @return Boolean true, if old sessions have been cleaned, otherwise an exception is thrown
93
- *
94
- * @throws \RuntimeException If any old sessions cannot be cleaned
81
+ * {@inheritdoc}
95
82
*/
96
83
public function gc ($ lifetime )
97
84
{
@@ -107,13 +94,7 @@ public function gc($lifetime)
107
94
}
108
95
109
96
/**
110
- * Reads a session.
111
- *
112
- * @param string $id A session ID
113
- *
114
- * @return string The session data if the session was read or created, otherwise an exception is thrown
115
- *
116
- * @throws \RuntimeException If the session cannot be read
97
+ * {@inheritdoc}
117
98
*/
118
99
public function read ($ id )
119
100
{
@@ -136,14 +117,7 @@ public function read($id)
136
117
}
137
118
138
119
/**
139
- * Writes session data.
140
- *
141
- * @param string $id A session ID
142
- * @param string $data A serialized chunk of session data
143
- *
144
- * @return Boolean true, if the session was written, otherwise an exception is thrown
145
- *
146
- * @throws \RuntimeException If the session data cannot be written
120
+ * {@inheritdoc}
147
121
*/
148
122
public function write ($ id , $ data )
149
123
{
0 commit comments