Skip to content

Commit ed4055b

Browse files
[Messenger] Preserve existing Doctrine schema
1 parent 173c519 commit ed4055b

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

Store/DoctrineDbalPostgreSqlStore.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1818
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
1919
use Doctrine\DBAL\Tools\DsnParser;
20-
use Doctrine\ORM\ORMSetup;
2120
use Symfony\Component\Lock\BlockingSharedLockStoreInterface;
2221
use Symfony\Component\Lock\BlockingStoreInterface;
2322
use Symfony\Component\Lock\Exception\InvalidArgumentException;
@@ -71,7 +70,7 @@ public function __construct($connOrUrl)
7170
$params = ['url' => $this->filterDsn($connOrUrl)];
7271
}
7372

74-
$config = class_exists(ORMSetup::class) ? ORMSetup::createConfiguration() : new Configuration();
73+
$config = new Configuration();
7574
if (class_exists(DefaultSchemaManagerFactory::class)) {
7675
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
7776
}

Store/DoctrineDbalStore.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
2121
use Doctrine\DBAL\Schema\Schema;
2222
use Doctrine\DBAL\Tools\DsnParser;
23-
use Doctrine\ORM\ORMSetup;
2423
use Symfony\Component\Lock\Exception\InvalidArgumentException;
2524
use Symfony\Component\Lock\Exception\InvalidTtlException;
2625
use Symfony\Component\Lock\Exception\LockConflictedException;
@@ -88,7 +87,7 @@ public function __construct($connOrUrl, array $options = [], float $gcProbabilit
8887
$params = ['url' => $connOrUrl];
8988
}
9089

91-
$config = class_exists(ORMSetup::class) ? ORMSetup::createConfiguration() : new Configuration();
90+
$config = new Configuration();
9291
if (class_exists(DefaultSchemaManagerFactory::class)) {
9392
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
9493
}

Tests/Store/DoctrineDbalPostgreSqlStoreTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Doctrine\DBAL\Exception as DBALException;
1818
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
1919
use Doctrine\DBAL\Tools\DsnParser;
20-
use Doctrine\ORM\ORMSetup;
2120
use Symfony\Component\Lock\Exception\InvalidArgumentException;
2221
use Symfony\Component\Lock\Exception\LockConflictedException;
2322
use Symfony\Component\Lock\Key;
@@ -176,7 +175,7 @@ public function testWaitAndSaveReadAfterConflictReleasesLockFromInternalStore()
176175
private static function getDbalConnection(string $dsn): Connection
177176
{
178177
$params = class_exists(DsnParser::class) ? (new DsnParser(['sqlite' => 'pdo_sqlite']))->parse($dsn) : ['url' => $dsn];
179-
$config = class_exists(ORMSetup::class) ? ORMSetup::createConfiguration(true) : new Configuration();
178+
$config = new Configuration();
180179
if (class_exists(DefaultSchemaManagerFactory::class)) {
181180
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
182181
}

Tests/Store/DoctrineDbalStoreTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Doctrine\DBAL\Exception\TableNotFoundException;
1818
use Doctrine\DBAL\Platforms\AbstractPlatform;
1919
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
20-
use Doctrine\ORM\ORMSetup;
2120
use Symfony\Component\Lock\Key;
2221
use Symfony\Component\Lock\PersistingStoreInterface;
2322
use Symfony\Component\Lock\Store\DoctrineDbalStore;
@@ -39,7 +38,7 @@ public static function setUpBeforeClass(): void
3938
{
4039
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_lock');
4140

42-
$config = class_exists(ORMSetup::class) ? ORMSetup::createConfiguration(true) : new Configuration();
41+
$config = new Configuration();
4342
if (class_exists(DefaultSchemaManagerFactory::class)) {
4443
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
4544
}
@@ -66,7 +65,7 @@ protected function getClockDelay()
6665
*/
6766
public function getStore(): PersistingStoreInterface
6867
{
69-
$config = class_exists(ORMSetup::class) ? ORMSetup::createConfiguration(true) : new Configuration();
68+
$config = new Configuration();
7069
if (class_exists(DefaultSchemaManagerFactory::class)) {
7170
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
7271
}

Tests/Store/PdoDbalStoreTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Doctrine\DBAL\DriverManager;
1717
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory;
1818
use Doctrine\DBAL\Schema\Schema;
19-
use Doctrine\ORM\ORMSetup;
2019
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
2120
use Symfony\Component\Lock\Key;
2221
use Symfony\Component\Lock\PersistingStoreInterface;
@@ -40,7 +39,7 @@ public static function setUpBeforeClass(): void
4039
{
4140
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_lock');
4241

43-
$config = class_exists(ORMSetup::class) ? ORMSetup::createConfiguration(true) : new Configuration();
42+
$config = new Configuration();
4443
if (class_exists(DefaultSchemaManagerFactory::class)) {
4544
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
4645
}
@@ -69,7 +68,7 @@ public function getStore(): PersistingStoreInterface
6968
{
7069
$this->expectDeprecation('Since symfony/lock 5.4: Usage of a DBAL Connection with "Symfony\Component\Lock\Store\PdoStore" is deprecated and will be removed in symfony 6.0. Use "Symfony\Component\Lock\Store\DoctrineDbalStore" instead.');
7170

72-
$config = class_exists(ORMSetup::class) ? ORMSetup::createConfiguration(true) : new Configuration();
71+
$config = new Configuration();
7372
if (class_exists(DefaultSchemaManagerFactory::class)) {
7473
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory());
7574
}

0 commit comments

Comments
 (0)