8000 [DoctrineBridge] Refactor session storage to handler. · symfony/symfony@a6a9280 · GitHub
[go: up one dir, main page]

Skip to content

Commit a6a9280

Browse files
author
Drak
committed
[DoctrineBridge] Refactor session storage to handler.
1 parent a1c678e commit a6a9280

File tree

2 files changed

+30
-47
lines changed

2 files changed

+30
-47
lines changed

src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorage.php renamed to src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<?php
22

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+
312
namespace Symfony\Bridge\Doctrine\HttpFoundation;
413

514
use Doctrine\DBAL\Platforms\MySqlPlatform;
6-
use Symfony\Component\HttpFoundation\Session\Storage\AbstractSessionStorage;
715
use Doctrine\DBAL\Driver\Connection;
816

917
/**
@@ -12,7 +20,7 @@
1220
* @author Fabien Potencier <fabien@symfony.com>
1321
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
1422
*/
15-
class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandlerInterface
23+
class DbalSessionHandler implements \SessionHandlerInterface
1624
{
1725
/**
1826
* @var Connection
@@ -25,36 +33,27 @@ class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandl
2533
private $tableName;
2634

2735
/**
36+
* Constructor.
2837
*
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.
3240
*/
33-
public function __construct(Connection $con, $tableName = 'sessions', array $options = array())
41+
public function __construct(Connection $con, $tableName = 'sessions')
3442
{
3543
$this->con = $con;
3644
$this->tableName = $tableName;
37-
38-
parent::__construct($options);
3945
}
4046

4147
/**
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}
4849
*/
4950
public function open($path = null, $name = null)
5051
{
5152
return true;
5253
}
5354

5455
/**
55-
* Closes a session.
56-
*
57-
* @return Boolean true, if the session was closed, otherwise false
56+
* {@inheritdoc}
5857
*/
5958
public function close()
6059
{
@@ -63,13 +62,7 @@ public function close()
6362
}
6463

6564
/**
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}
7366
*/
7467
public function destroy($id)
7568
{
@@ -85,13 +78,7 @@ public function destroy($id)
8578
}
8679

8780
/**
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}
9582
*/
9683
public function gc($lifetime)
9784
{
@@ -107,13 +94,7 @@ public function gc($lifetime)
10794
}
10895

10996
/**
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}
11798
*/
11899
public function read($id)
119100
{
@@ -136,14 +117,7 @@ public function read($id)
136117
}
137118

138119
/**
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}
147121
*/
148122
public function write($id, $data)
149123
{

src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorageSchema.php renamed to src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandlerSchema.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

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+
312
namespace Symfony\Bridge\Doctrine\HttpFoundation;
413

514
use Doctrine\DBAL\Schema\Schema;
@@ -9,7 +18,7 @@
918
*
1019
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
1120
*/
12-
final class DbalSessionStorageSchema extends Schema
21+
final class DbalSessionHandlerSchema extends Schema
1322
{
1423
private $tableName;
1524

0 commit comments

Comments
 (0)
0