From a6a9280a3b43209f977f6a89c62c6bf6acc195a8 Mon Sep 17 00:00:00 2001 From: Drak Date: Sun, 4 Mar 2012 16:45:42 +0545 Subject: [PATCH] [DoctrineBridge] Refactor session storage to handler. --- ...sionStorage.php => DbalSessionHandler.php} | 66 ++++++------------- ...chema.php => DbalSessionHandlerSchema.php} | 11 +++- 2 files changed, 30 insertions(+), 47 deletions(-) rename src/Symfony/Bridge/Doctrine/HttpFoundation/{DbalSessionStorage.php => DbalSessionHandler.php} (69%) rename src/Symfony/Bridge/Doctrine/HttpFoundation/{DbalSessionStorageSchema.php => DbalSessionHandlerSchema.php} (76%) diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorage.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php similarity index 69% rename from src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorage.php rename to src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php index a260c3a149..cef6cec860 100644 --- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorage.php +++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandler.php @@ -1,9 +1,17 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bridge\Doctrine\HttpFoundation; use Doctrine\DBAL\Platforms\MySqlPlatform; -use Symfony\Component\HttpFoundation\Session\Storage\AbstractSessionStorage; use Doctrine\DBAL\Driver\Connection; /** @@ -12,7 +20,7 @@ use Doctrine\DBAL\Driver\Connection; * @author Fabien Potencier * @author Johannes M. Schmitt */ -class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandlerInterface +class DbalSessionHandler implements \SessionHandlerInterface { /** * @var Connection @@ -25,26 +33,19 @@ class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandl private $tableName; /** + * Constructor. * - * @param Connection $con An instance of Connection. - * @param string $tableName Table name. - * @param array $options Session configuration options + * @param Connection $con An instance of Connection. + * @param string $tableName Table name. */ - public function __construct(Connection $con, $tableName = 'sessions', array $options = array()) + public function __construct(Connection $con, $tableName = 'sessions') { $this->con = $con; $this->tableName = $tableName; - - parent::__construct($options); } /** - * Opens a session. - * - * @param string $path (ignored) - * @param string $name (ignored) - * - * @return Boolean true, if the session was opened, otherwise an exception is thrown + * {@inheritdoc} */ public function open($path = null, $name = null) { @@ -52,9 +53,7 @@ class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandl } /** - * Closes a session. - * - * @return Boolean true, if the session was closed, otherwise false + * {@inheritdoc} */ public function close() { @@ -63,13 +62,7 @@ class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandl } /** - * Destroys a session. - * - * @param string $id A session ID - * - * @return Boolean true, if the session was destroyed, otherwise an exception is thrown - * - * @throws \RuntimeException If the session cannot be destroyed + * {@inheritdoc} */ public function destroy($id) { @@ -85,13 +78,7 @@ class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandl } /** - * Cleans up old sessions. - * - * @param int $lifetime The lifetime of a session - * - * @return Boolean true, if old sessions have been cleaned, otherwise an exception is thrown - * - * @throws \RuntimeException If any old sessions cannot be cleaned + * {@inheritdoc} */ public function gc($lifetime) { @@ -107,13 +94,7 @@ class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandl } /** - * Reads a session. - * - * @param string $id A session ID - * - * @return string The session data if the session was read or created, otherwise an exception is thrown - * - * @throws \RuntimeException If the session cannot be read + * {@inheritdoc} */ public function read($id) { @@ -136,14 +117,7 @@ class DbalSessionStorage extends AbstractSessionStorage implements \SessionHandl } /** - * Writes session data. - * - * @param string $id A session ID - * @param string $data A serialized chunk of session data - * - * @return Boolean true, if the session was written, otherwise an exception is thrown - * - * @throws \RuntimeException If the session data cannot be written + * {@inheritdoc} */ public function write($id, $data) { diff --git a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorageSchema.php b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandlerSchema.php similarity index 76% rename from src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorageSchema.php rename to src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandlerSchema.php index b33862588c..b7b4b91a7a 100644 --- a/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorageSchema.php +++ b/src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionHandlerSchema.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bridge\Doctrine\HttpFoundation; use Doctrine\DBAL\Schema\Schema; @@ -9,7 +18,7 @@ use Doctrine\DBAL\Schema\Schema; * * @author Johannes M. Schmitt */ -final class DbalSessionStorageSchema extends Schema +final class DbalSessionHandlerSchema extends Schema { private $tableName;