Skip to content

Commit 2627288

Browse files
Merge branch '7.1' into 7.2
* 7.1: [DoctrineBridge] Fix the `LockStoreSchemaListener` add German translations for the Week constraint messages sync Week constraint messages translations [Validator] Add `D` regex modifier in relevant validators [Validator] Add French translation for the `Week` constraint skip transient Redis integration tests on AppVeyor reject malformed URLs with a meaningful exception [Mime] Add tests on constraints fix denormalizing mixed collection values
2 parents c29422b + 5c31b27 commit 2627288

File tree

2 files changed

+5
-31
lines changed

2 files changed

+5
-31
lines changed

SchemaListener/LockStoreSchemaListener.php

+4-13
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
}

Tests/SchemaListener/LockStoreSchemaListenerTest.php

+1-18
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
@@ -37,23 +36,7 @@ public function testPostGenerateSchemaLockPdo()
3736
->method('configureSchema')
3837
->with($schema, fn () => true);
3938

40-
$subscriber = new LockStoreSchemaListener([$lockStore]);
41-
$subscriber->postGenerateSchema($event);
42-
}
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-
})());
39+
$subscriber = new LockStoreSchemaListener((static fn () => yield $lockStore)());
5740
$subscriber->postGenerateSchema($event);
5841
}
5942
}

0 commit comments

Comments
 (0)