Skip to content

Commit 21e71a7

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: (22 commits) fix merge [AssetMapper] Check asset/vendor directory is writable detect wrong e-mail validation modes detect wrong usages of minMessage/maxMessage in options [Security] Remove workflow from empty folder read form values using the chain data accessor [Validator] Review Bulgarian (bg) translation Reviewed italian translation Fix french translation call substr() with integer offsets [Finder] Also consider .git inside the basedir of in() directory review: FR translation [Serializer] Add AbstractNormalizerContextBuilder::defaultConstructorArguments() Update spanish and catalan translations Update AbstractSchemaListener.php to adjust more database params Updated id=113 Arabic translation. #53771 Updated validator Lithuanian translations review: translation RU [PropertyInfo] Fix PHPStan properties type in trait explicitly cast boolean SSL stream options ...
2 parents 79d87e0 + da60553 commit 21e71a7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

SchemaListener/AbstractSchemaListener.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
use Doctrine\DBAL\Connection;
1515
use Doctrine\DBAL\Exception\TableNotFoundException;
16+
use Doctrine\DBAL\Schema\Table;
17+
use Doctrine\DBAL\Types\Types;
1618
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
1719

1820
abstract class AbstractSchemaListener
@@ -22,8 +24,16 @@ abstract public function postGenerateSchema(GenerateSchemaEventArgs $event): voi
2224
protected function getIsSameDatabaseChecker(Connection $connection): \Closure
2325
{
2426
return static function (\Closure $exec) use ($connection): bool {
27+
$schemaManager = $connection->createSchemaManager();
28+
2529
$checkTable = 'schema_subscriber_check_'.bin2hex(random_bytes(7));
26-
$connection->executeStatement(sprintf('CREATE TABLE %s (id INTEGER NOT NULL)', $checkTable));
30+
$table = new Table($checkTable);
31+
$table->addColumn('id', Types::INTEGER)
32+
->setAutoincrement(true)
33+
->setNotnull(true);
34+
$table->setPrimaryKey(['id']);
35+
36+
$schemaManager->createTable($table);
2737

2838
try {
2939
$exec(sprintf('DROP TABLE %s', $checkTable));
@@ -32,7 +42,7 @@ protected function getIsSameDatabaseChecker(Connection $connection): \Closure
3242
}
3343

3444
try {
35-
$connection->executeStatement(sprintf('DROP TABLE %s', $checkTable));
45+
$schemaManager->dropTable($checkTable);
3646

3747
return false;
3848
} catch (TableNotFoundException) {

0 commit comments

Comments
 (0)