Skip to content

Commit e998b07

Browse files
committed
[Lock] create migration for lock table when DoctrineDbalStore is used
1 parent 10a951b commit e998b07

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\SchemaListener;
13+
14+
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
15+
use Symfony\Component\Lock\PersistingStoreInterface;
16+
use Symfony\Component\Lock\Store\DoctrineDbalStore;
17+
18+
final class LockStoreSchemaSubscriber extends AbstractSchemaSubscriber
19+
{
20+
/**
21+
* @param iterable<mixed, PersistingStoreInterface> $stores
22+
*/
23+
public function __construct(private iterable $stores)
24+
{
25+
}
26+
27+
public function postGenerateSchema(GenerateSchemaEventArgs $event): void
28+
{
29+
$connection = $event->getEntityManager()->getConnection();
30+
31+
foreach ($this->stores as $store) {
32+
if (!$store instanceof DoctrineDbalStore) {
33+
continue;
34+
}
35+
36+
$store->configureSchema($event->getSchema(), $this->getIsSameDatabaseChecker($connection));
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)