Skip to content

Commit 74ccf70

Browse files
committed
reverted 5b7ef11 (Simplify session
storage class names now we have a separate namespace for sessions)
1 parent 91f4f8a commit 74ccf70

35 files changed

+120
-120
lines changed

CHANGELOG-2.1.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c
239239
`getFlash()`, `hasFlash()`, andd `removeFlash()`. `getFlashes() returns a `FlashBagInterface`.
240240
* `Session->clear()` now only clears session attributes as before it cleared flash messages and
241241
attributes. `Session->getFlashes()->all()` clears flashes now.
242-
* Added `Symfony\Component\HttpFoundation\Session\Storage\AbstractStorage` base class for
242+
* Added `Symfony\Component\HttpFoundation\Session\Storage\AbstractSessionStorage` base class for
243243
session storage drivers.
244244
* Added `Symfony\Component\HttpFoundation\Session\Storage\SaveHandlerInterface` interface
245245
which storage drivers should implement after inheriting from
246-
`Symfony\Component\HttpFoundation\Session\Storage\AbstractStorage` when writing custom session save handlers.
246+
`Symfony\Component\HttpFoundation\Session\Storage\AbstractSessionStorage` when writing custom session save handlers.
247247
* [BC BREAK] `StorageInterface` methods removed: `write()`, `read()` and `remove()`. Added
248248
`getBag()`, `registerBag()`.
249249
* Moved attribute storage to `Symfony\Component\HttpFoundation\Attribute\AttributeBagInterface`.
@@ -252,10 +252,10 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c
252252
* Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for namespace session attributes.
253253
* Session now implements `Symfony\Component\HttpFoundation\Session\SessionInterface` making
254254
implementation customizable and portable.
255-
* [BC BREAK] Removed `NativeStorage` and replaced with `NativeFileStorage`.
255+
* [BC BREAK] Removed `NativeSessionStorage` and replaced with `NativeFileSessionStorage`.
256256
* Added session storage drivers for PHP native Memcache, Memcached and SQLite session save handlers.
257257
* Added session storage drivers for custom Memcache, Memcached and Null session save handlers.
258-
* Removed `FilesystemStorage`, use `MockFileStorage` for functional testing instead.
258+
* Removed `FilesystemSessionStorage`, use `MockFileSessionStorage` for functional testing instead.
259259

260260
### HttpKernel
261261

UPGRADE-2.1.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ UPGRADE FROM 2.0 to 2.1
301301
* Session storage drivers
302302

303303
Session storage drivers should inherit from
304-
`Symfony\Component\HttpFoundation\Session\Storage\AbstractStorage`
304+
`Symfony\Component\HttpFoundation\Session\Storage\AbstractSessionStorage`
305305
and no longer should implement `read()`, `write()`, `remove()` which were removed from the
306-
`StorageInterface`.
306+
`SessionStorageInterface`.
307307

308308
Any session storage driver that wants to use custom save handlers should
309309
implement `Symfony\Component\HttpFoundation\Session\Storage\SaveHandlerInterface`

src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Symfony\Bridge\Doctrine\HttpFoundation;
44

55
use Doctrine\DBAL\Platforms\MySqlPlatform;
6-
use Symfony\Component\HttpFoundation\Session\Storage\AbstractStorage;
7-
use Symfony\Component\HttpFoundation\Session\Storage\SaveHandlerInterface;
6+
use Symfony\Component\HttpFoundation\Session\Storage\AbstractSessionStorage;
7+
use Symfony\Component\HttpFoundation\Session\Storage\SessionSaveHandlerInterface;
88
use Doctrine\DBAL\Driver\Connection;
99

1010
/**
@@ -13,7 +13,7 @@
1313
* @author Fabien Potencier <fabien@symfony.com>
1414
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
1515
*/
16-
class DbalStorage extends AbstractStorage implements SaveHandlerInterface
16+
class DbalSessionStorage extends AbstractSessionStorage implements SessionSaveHandlerInterface
1717
{
1818
/**
1919
* @var Connection

src/Symfony/Bridge/Doctrine/HttpFoundation/DbalSessionStorageSchema.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
1111
*/
12-
final class DbalStorageSchema extends Schema
12+
final class DbalSessionStorageSchema extends Schema
1313
{
1414
private $tableName;
1515

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
301301

302302
$this->addClassesToCompile(array(
303303
'Symfony\\Bundle\\FrameworkBundle\\EventListener\\SessionListener',
304-
'Symfony\\Component\\HttpFoundation\\Session\Storage\\StorageInterface',
304+
'Symfony\\Component\\HttpFoundation\\Session\Storage\\SessionStorageInterface',
305305
$container->getDefinition('session')->getClass(),
306306
));
307307

src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
<parameter key="session.class">Symfony\Component\HttpFoundation\Session\Session</parameter>
99
<parameter key="session.flashbag.class">Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag</parameter>
1010
<parameter key="session.attribute_bag.class">Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag</parameter>
11-
<parameter key="session.storage.native_file.class">Symfony\Component\HttpFoundation\Session\Storage\NativeFileStorage</parameter>
12-
<parameter key="session.storage.null.class">Symfony\Component\HttpFoundation\Session\Storage\NullStorage</parameter>
13-
<parameter key="session.storage.native_memcache.class">Symfony\Component\HttpFoundation\Session\Storage\NativeMemcacheStorage</parameter>
14-
<parameter key="session.storage.native_memcached.class">Symfony\Component\HttpFoundation\Session\Storage\NativeMemcachedStorage</parameter>
15-
<parameter key="session.storage.native_sqlite.class">Symfony\Component\HttpFoundation\Session\Storage\NativeSqliteStorage</parameter>
16-
<parameter key="session.storage.memcache.class">Symfony\Component\HttpFoundation\Session\Storage\MemcacheStorage</parameter>
17-
<parameter key="session.storage.memcached.class">Symfony\Component\HttpFoundation\Session\Storage\MemcachedStorage</parameter>
18-
<parameter key="session.storage.mock_file.class">Symfony\Component\HttpFoundation\Session\Storage\MockFileStorage</parameter>
11+
<parameter key="session.storage.native_file.class">Symfony\Component\HttpFoundation\Session\Storage\NativeFileSessionStorage</parameter>
12+
<parameter key="session.storage.null.class">Symfony\Component\HttpFoundation\Session\Storage\NullSessionStorage</parameter>
13+
<parameter key="session.storage.native_memcache.class">Symfony\Component\HttpFoundation\Session\Storage\NativeMemcacheSessionStorage</parameter>
14+
<parameter key="session.storage.native_memcached.class">Symfony\Component\HttpFoundation\Session\Storage\NativeMemcachedSessionStorage</parameter>
15+
<parameter key="session.storage.native_sqlite.class">Symfony\Component\HttpFoundation\Session\Storage\NativeSqliteSessionStorage</parameter>
16+
<parameter key="session.storage.memcache.class">Symfony\Component\HttpFoundation\Session\Storage\MemcacheSessionStorage</parameter>
17+
<parameter key="session.storage.memcached.class">Symfony\Component\HttpFoundation\Session\Storage\MemcachedSessionStorage</parameter>
18+
<parameter key="session.storage.mock_file.class">Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage</parameter>
1919
<parameter key="session.memcache.class">Memcache</parameter>
2020
<parameter key="session.memcached.class">Memcached</parameter>
2121

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\HttpFoundation\Session\Session;
16-
use Symfony\Component\HttpFoundation\Session\Storage\MockArrayStorage;
16+
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
1717
use Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper;
1818

1919
class SessionHelperTest extends \PHPUnit_Framework_TestCase
@@ -24,7 +24,7 @@ public function setUp()
2424
{
2525
$this->request = new Request();
2626

27-
$session = new Session(new MockArrayStorage());
27+
$session = new Session(new MockArraySessionStorage());
2828
$session->set('foobar', 'bar');
2929
$session->getFlashes()->set('notice', 'bar');
3030

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/PhpEngineTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\DependencyInjection\Container;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Session\Session;
18-
use Symfony\Component\HttpFoundation\Session\Storage\MockArrayStorage;
18+
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
1919
use Symfony\Component\Templating\TemplateNameParser;
2020
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
2121
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
@@ -64,7 +64,7 @@ protected function getContainer()
6464
{
6565
$container = new Container();
6666
$request = new Request();
67-
$session = new Session(new MockArrayStorage());
67+
$session = new Session(new MockArraySessionStorage());
6868

6969
$request->setSession($session);
7070
$container->set('request', $request);

src/Symfony/Bundle/TwigBundle/Tests/TwigEngineTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\DependencyInjection\Container;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Session\Session;
18-
use Symfony\Component\HttpFoundation\Session\Storage\MockArrayStorage;
18+
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
1919
use Symfony\Component\Templating\TemplateNameParser;
2020
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables;
2121

@@ -71,7 +71,7 @@ protected function getContainer()
7171
{
7272
$container = new Container();
7373
$request = new Request();
74-
$session = new Session(new MockArrayStorage());
74+
$session = new Session(new MockArraySessionStorage());
7575

7676
$request->setSession($session);
7777
$container->set('request', $request);

src/Symfony/Component/DependencyInjection/Container.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
*
4444
* <ul>
4545
* <li>request -> getRequestService()</li>
46-
* <li>mysql_session_storage -> getMysqlStorageService()</li>
47-
* <li>symfony.mysql_session_storage -> getSymfony_MysqlStorageService()</li>
46+
* <li>mysql_session_storage -> getMysqlSessionStorageService()</li>
47+
* <li>symfony.mysql_session_storage -> getSymfony_MysqlSessionStorageService()</li>
4848
* </ul>
4949
*
5050
* The container can have three possible behaviors when a service does not exist:

src/Symfony/Component/HttpFoundation/Session/Session.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\HttpFoundation\Session;
1313

14-
use Symfony\Component\HttpFoundation\Session\Storage\StorageInterface;
14+
use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
1515
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
1616
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
1717
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
@@ -31,18 +31,18 @@ class Session implements SessionInterface
3131
/**
3232
* Storage driver.
3333
*
34-
* @var StorageInterface
34+
* @var SessionStorageInterface
3535
*/
3636
protected $storage;
3737

3838
/**
3939
* Constructor.
4040
*
41-
* @param StorageInterface $storage A StorageInterface instance.
41+
* @param SessionStorageInterface $storage A SessionStorageInterface instance.
4242
* @param AttributeBagInterface $attributes An AttributeBagInterface instance, (defaults null for default AttributeBag)
4343
* @param FlashBagInterface $flashes A FlashBagInterface instance (defaults null for default FlashBag)
4444
*/
45-
public function __construct(StorageInterface $storage, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null)
45+
public function __construct(SessionStorageInterface $storage, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null)
4646
{
4747
$this->storage = $storage;
4848
$this->registerBag($attributes ?: new AttributeBag());
@@ -204,7 +204,7 @@ public function getId()
204204
/**
205205
* Implements the \Serialize interface.
206206
*
207-
* @return StorageInterface
207+
* @return SessionStorageInterface
208208
*/
209209
public function serialize()
210210
{
@@ -214,13 +214,13 @@ public function serialize()
214214
/**
215215
* Implements the \Serialize interface.
216216
*
217-
* @throws \InvalidArgumentException If the passed string does not unserialize to an instance of StorageInterface
217+
* @throws \InvalidArgumentException If the passed string does not unserialize to an instance of SessionStorageInterface
218218
*/
219219
public function unserialize($serialized)
220220
{
221221
$storage = unserialize($serialized);
222-
if (!$storage instanceof StorageInterface) {
223-
throw new \InvalidArgumentException('Serialized data did not return a valid instance of StorageInterface');
222+
if (!$storage instanceof SessionStorageInterface) {
223+
throw new \InvalidArgumentException('Serialized data did not return a valid instance of SessionStorageInterface');
224224
}
225225

226226
$this->storage = $storage;

src/Symfony/Component/HttpFoundation/Session/Storage/AbstractStorage.php renamed to src/Symfony/Component/HttpFoundation/Session/Storage/AbstractSessionStorage.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @author Drak <drak@zikula.org>
2020
*/
21-
abstract class AbstractStorage implements StorageInterface
21+
abstract class AbstractSessionStorage implements SessionStorageInterface
2222
{
2323
/**
2424
* Array of SessionBagInterface
@@ -293,7 +293,7 @@ protected function registerSaveHandlers()
293293
{
294294
// note this can be reset to PHP's control using ini_set('session.save_handler', 'files');
295295
// so long as ini_set() is called before the session is started.
296-
if ($this instanceof SaveHandlerInterface) {
296+
if ($this instanceof SessionSaveHandlerInterface) {
297297
session_set_save_handler(
298298
array($this, 'openSession'),
299299
array($this, 'closeSession'),

src/Symfony/Component/HttpFoundation/Session/Storage/MemcacheStorage.php renamed to src/Symfony/Component/HttpFoundation/Session/Storage/MemcacheSessionStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage;
1313

1414
/**
15-
* MemcacheStorage.
15+
* MemcacheSessionStorage.
1616
*
1717
* @author Drak <drak@zikula.org>
1818
*/
19-
class MemcacheStorage extends AbstractStorage implements SaveHandlerInterface
19+
class MemcacheSessionStorage extends AbstractSessionStorage implements SessionSaveHandlerInterface
2020
{
2121
/**
2222
* Memcache driver.
@@ -46,7 +46,7 @@ class MemcacheStorage extends AbstractStorage implements SaveHandlerInterface
4646
* @param array $memcacheOptions An associative array of Memcachge options
4747
* @param array $options Session configuration options.
4848
*
49-
* @see AbstractStorage::__construct()
49+
* @see AbstractSessionStorage::__construct()
5050
*/
5151
public function __construct(\Memcache $memcache, array $memcacheOptions = array(), array $options = array())
5252
{

src/Symfony/Component/HttpFoundation/Session/Storage/MemcachedStorage.php renamed to src/Symfony/Component/HttpFoundation/Session/Storage/MemcachedSessionStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage;
1313

1414
/**
15-
* MemcachedStorage.
15+
* MemcachedSessionStorage.
1616
*
1717
* @author Drak <drak@zikula.org>
1818
*/
19-
class MemcachedStorage extends AbstractStorage implements SaveHandlerInterface
19+
class MemcachedSessionStorage extends AbstractSessionStorage implements SessionSaveHandlerInterface
2020
{
2121
/**
2222
* Memcached driver.
@@ -39,7 +39,7 @@ class MemcachedStorage extends AbstractStorage implements SaveHandlerInterface
3939
* @param array $memcachedOptions An associative array of Memcached options
4040
* @param array $options Session configuration options.
4141
*
42-
* @see AbstractStorage::__construct()
42+
* @see AbstractSessionStorage::__construct()
4343
*/
4444
public function __construct(\Memcached $memcache, array $memcachedOptions = array(), array $options = array())
4545
{

src/Symfony/Component/HttpFoundation/Session/Storage/MockArrayStorage.php renamed to src/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage;
1313

1414
/**
15-
* MockArrayStorage mocks the session for unit tests.
15+
* MockArraySessionStorage mocks the session for unit tests.
1616
*
1717
* No PHP session is actually started since a session can be initialized
1818
* and shutdown only once per PHP execution cycle.
1919
*
20-
* When doing functional testing, you should use MockFileStorage instead.
20+
* When doing functional testing, you should use MockFileSessionStorage instead.
2121
*
2222
* @author Fabien Potencier <fabien@symfony.com>
2323
* @author Bulat Shakirzyanov <mallluhuct@gmail.com>
2424
* @author Drak <drak@zikula.org>
2525
*/
26-
class MockArrayStorage extends AbstractStorage
26+
class MockArraySessionStorage extends AbstractSessionStorage
2727
{
2828
/**
2929
* @var string

src/Symfony/Component/HttpFoundation/Session/Storage/MockFileStorage.php renamed to src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage;
1313

1414
/**
15-
* MockFileStorage is used to mock sessions for
15+
* MockFileSessionStorage is used to mock sessions for
1616
* functional testing when done in a single PHP process.
1717
*
1818
* No PHP session is actually started since a session can be initialized
1919
* and shutdown only once per PHP execution cycle.
2020
*
2121
* @author Drak <drak@zikula.org>
2222
*/
23-
class MockFileStorage extends MockArrayStorage
23+
class MockFileSessionStorage extends MockArraySessionStorage
2424
{
2525
/**
2626
* @var string
@@ -33,7 +33,7 @@ class MockFileStorage extends MockArrayStorage
3333
* @param string $savePath Path of directory to save session files.
3434
* @param array $options Session options.
3535
*
36-
* @see AbstractStorage::__construct()
36+
* @see AbstractSessionStorage::__construct()
3737
*/
3838
public function __construct($savePath = null, array $options = array())
3939
{

src/Symfony/Component/HttpFoundation/Session/Storage/NativeFileStorage.php renamed to src/Symfony/Component/HttpFoundation/Session/Storage/NativeFileSessionStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage;
1313

1414
/**
15-
* NativeFileStorage.
15+
* NativeFileSessionStorage.
1616
*
1717
* Native session handler using PHP's built in file storage.
1818
*
1919
* @author Drak <drak@zikula.org>
2020
*/
21-
class NativeFileStorage extends AbstractStorage
21+
class NativeFileSessionStorage extends AbstractSessionStorage
2222
{
2323
/**
2424
* @var string
@@ -31,7 +31,7 @@ class NativeFileStorage extends AbstractStorage
3131
* @param string $savePath Path of directory to save session files.
3232
* @param array $options Session configuration options.
3333
*
34-
* @see AbstractStorage::__construct()
34+
* @see AbstractSessionStorage::__construct()
3535
*/
3636
public function __construct($savePath = null, array $options = array())
3737
{

src/Symfony/Component/HttpFoundation/Session/Storage/NativeMemcacheStorage.php renamed to src/Symfony/Component/HttpFoundation/Session/Storage/NativeMemcacheSessionStorage.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage;
1313

1414
/**
15-
* NativeMemcacheStorage.
15+
* NativeMemcacheSessionStorage.
1616
*
1717
* Session based on native PHP memcache database handler.
1818
*
1919
* @author Drak <drak@zikula.org>
2020
*/
21-
class NativeMemcacheStorage extends AbstractStorage
21+
class NativeMemcacheSessionStorage extends AbstractSessionStorage
2222
{
2323
/**
2424
* @var string
@@ -31,7 +31,7 @@ class NativeMemcacheStorage extends AbstractStorage
3131
* @param string $savePath Path of memcache server.
3232
* @param array $options Session configuration options.
3333
*
34-
* @see AbstractStorage::__construct()
34+
* @see AbstractSessionStorage::__construct()
3535
*/
3636
public function __construct($savePath = 'tcp://127.0.0.1:11211?persistent=0', array $options = array())
3737
{

0 commit comments

Comments
 (0)