Skip to content

Commit d6b4d84

Browse files
Revert "[DoctrineBridge] Ignore invalid stores in LockStoreSchemaListener raised by StoreFactory"
This reverts commit 0acd403.
1 parent c87e4a1 commit d6b4d84

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

src/Symfony/Bridge/Doctrine/SchemaListener/LockStoreSchemaListener.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bridge\Doctrine\SchemaListener;
1313

1414
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
15-
use Symfony\Component\Lock\Exception\InvalidArgumentException;
1615
use Symfony\Component\Lock\PersistingStoreInterface;
1716
use Symfony\Component\Lock\Store\DoctrineDbalStore;
1817

@@ -30,20 +29,12 @@ public function postGenerateSchema(GenerateSchemaEventArgs $event): void
3029
{
3130
$connection = $event->getEntityManager()->getConnection();
3231

33-
$storesIterator = new \ArrayIterator($this->stores);
34-
while ($storesIterator->valid()) {
35-
try {
36-
$store = $storesIterator->current();
37-
if (!$store instanceof DoctrineDbalStore) {
38-
continue;
39-
}
40-
41-
$store->configureSchema($event->getSchema(), $this->getIsSameDatabaseChecker($connection));
42-
} catch (InvalidArgumentException) {
43-
// no-op
32+
foreach ($this->stores as $store) {
33+
if (!$store instanceof DoctrineDbalStore) {
34+
continue;
4435
}
4536

46-
$storesIterator->next();
37+
$store->configureSchema($event->getSchema(), $this->getIsSameDatabaseChecker($connection));
4738
}
4839
}
4940
}

src/Symfony/Bridge/Doctrine/Tests/SchemaListener/LockStoreSchemaListenerTest.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
1818
use PHPUnit\Framework\TestCase;
1919
use Symfony\Bridge\Doctrine\SchemaListener\LockStoreSchemaListener;
20-
use Symfony\Component\Lock\Exception\InvalidArgumentException;
2120
use Symfony\Component\Lock\Store\DoctrineDbalStore;
2221

2322
class LockStoreSchemaListenerTest extends TestCase
@@ -40,20 +39,4 @@ public function testPostGenerateSchemaLockPdo()
4039
$subscriber = new LockStoreSchemaListener([$lockStore]);
4140
$subscriber->postGenerateSchema($event);
4241
}
43-
44-
public function testPostGenerateSchemaWithInvalidLockStore()
45-
{
46-
$entityManager = $this->createMock(EntityManagerInterface::class);
47-
$entityManager->expects($this->once())
48-
->method('getConnection')
49-
->willReturn($this->createMock(Connection::class));
50-
$event = new GenerateSchemaEventArgs($entityManager, new Schema());
51-
52-
$subscriber = new LockStoreSchemaListener((static function (): \Generator {
53-
yield $this->createMock(DoctrineDbalStore::class);
54-
55-
throw new InvalidArgumentException('Unsupported Connection');
56-
})());
57-
$subscriber->postGenerateSchema($event);
58-
}
5942
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy