Skip to content

Commit be2febb

Browse files
committed
Fix wrong interface for MongoDbStore
1 parent 1bdae34 commit be2febb

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

UPGRADE-5.2.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ FrameworkBundle
1616
used to be added by default to the seed, which is not the case anymore. This allows sharing caches between
1717
apps or different environments.
1818

19+
Lock
20+
----
21+
22+
* `MongoDbStore` does not implement `BlockingStoreInterface` anymore, typehint against `PersistingStoreInterface` instead.
23+
24+
1925
Mime
2026
----
2127

src/Symfony/Component/Lock/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.2.0
5+
-----
6+
7+
* `MongoDbStore` does not implement `BlockingStoreInterface` anymore, typehint against `PersistingStoreInterface` instead.
8+
49
5.1.0
510
-----
611

src/Symfony/Component/Lock/Store/MongoDbStore.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919
use MongoDB\Exception\DriverRuntimeException;
2020
use MongoDB\Exception\InvalidArgumentException as MongoInvalidArgumentException;
2121
use MongoDB\Exception\UnsupportedException;
22-
use Symfony\Component\Lock\BlockingStoreInterface;
2322
use Symfony\Component\Lock\Exception\InvalidArgumentException;
2423
use Symfony\Component\Lock\Exception\InvalidTtlException;
2524
use Symfony\Component\Lock\Exception\LockAcquiringException;
2625
use Symfony\Component\Lock\Exception\LockConflictedException;
2726
use Symfony\Component\Lock\Exception\LockExpiredException;
2827
use Symfony\Component\Lock\Exception\LockStorageException;
29-
use Symfony\Component\Lock\Exception\NotSupportedException;
3028
use Symfony\Component\Lock\Key;
29+
use Symfony\Component\Lock\PersistingStoreInterface;
3130

3231
/**
3332
* MongoDbStore is a StoreInterface implementation using MongoDB as a storage
@@ -46,7 +45,7 @@
4645
*
4746
* @author Joe Bennett <joe@assimtech.com>
4847
*/
49-
class MongoDbStore implements BlockingStoreInterface
48+
class MongoDbStore implements PersistingStoreInterface
5049
{
5150
private $collection;
5251
private $client;
@@ -224,14 +223,6 @@ public function save(Key $key)
224223
$this->checkNotExpired($key);
225224
}
226225

227-
/**
228-
* {@inheritdoc}
229-
*/
230-
public function waitAndSave(Key $key)
231-
{
232-
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', __CLASS__));
233-
}
234-
235226
/**
236227
* {@inheritdoc}
237228
*

src/Symfony/Component/Lock/Tests/Store/MongoDbStoreTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use MongoDB\Client;
1515
use MongoDB\Driver\Exception\ConnectionTimeoutException;
1616
use Symfony\Component\Lock\Exception\InvalidArgumentException;
17-
use Symfony\Component\Lock\Exception\NotSupportedException;
1817
use Symfony\Component\Lock\Key;
1918
use Symfony\Component\Lock\PersistingStoreInterface;
2019
use Symfony\Component\Lock\Store\MongoDbStore;
@@ -81,17 +80,6 @@ public function testCreateIndex()
8180
$this->assertContains('expires_at_1', $indexes);
8281
}
8382

84-
public function testNonBlocking()
85-
{
86-
$this->expectException(NotSupportedException::class);
87-
88-
$store = $this->getStore();
89-
90-
$key = new Key(uniqid(__METHOD__, true));
91-
92-
$store->waitAndSave($key);
93-
}
94-
9583
/**
9684
* @dataProvider provideConstructorArgs
9785
*/

0 commit comments

Comments
 (0)