Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a6a3bce

Browse filesBrowse files
martinssipenkoderrabus
authored andcommitted
[Lock] create lock table if it does not exist
1 parent a12336a commit a6a3bce
Copy full SHA for a6a3bce

File tree

3 files changed

+4
-2
lines changed
Filter options

3 files changed

+4
-2
lines changed

‎src/Symfony/Component/Lock/Store/DoctrineDbalStore.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Store/DoctrineDbalStore.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\DBAL\Connection;
1515
use Doctrine\DBAL\DriverManager;
1616
use Doctrine\DBAL\Exception as DBALException;
17+
use Doctrine\DBAL\Exception\TableNotFoundException;
1718
use Doctrine\DBAL\ParameterType;
1819
use Doctrine\DBAL\Schema\Schema;
1920
use Symfony\Component\Lock\Exception\InvalidArgumentException;
@@ -90,6 +91,9 @@ public function save(Key $key)
9091
ParameterType::STRING,
9192
ParameterType::STRING,
9293
]);
94+
} catch (TableNotFoundException $e) {
95+
$this->createTable();
96+
$this->save($key);
9397
} catch (DBALException $e) {
9498
// the lock is already acquired. It could be us. Let's try to put off.
9599
$this->putOffExpiration($key, $this->initialTtl);

‎src/Symfony/Component/Lock/Tests/Store/DoctrineDbalStoreTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Tests/Store/DoctrineDbalStoreTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public function testDsn(string $dsn, string $file = null)
7070

7171
try {
7272
$store = new DoctrineDbalStore($dsn);
73-
$store->createTable();
7473

7574
$store->save($key);
7675
$this->assertTrue($store->exists($key));

‎src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public function testDsn(string $dsn, string $file = null)
8484

8585
try {
8686
$store = new PdoStore($dsn);
87-
$store->createTable();
8887

8988
$store->save($key);
9089
$this->assertTrue($store->exists($key));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.