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 baeeadd

Browse filesBrowse files
committed
[Messenger] Retrieve table default options from the SchemaManager
1 parent 950306a commit baeeadd
Copy full SHA for baeeadd

File tree

1 file changed

+5
-2
lines changed
Filter options

1 file changed

+5
-2
lines changed

‎src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\DBAL\Exception\TableNotFoundException;
1717
use Doctrine\DBAL\Query\QueryBuilder;
1818
use Doctrine\DBAL\Schema\Schema;
19+
use Doctrine\DBAL\Schema\SchemaConfig;
1920
use Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer;
2021
use Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer;
2122
use Doctrine\DBAL\Types\Type;
@@ -52,12 +53,14 @@ class Connection
5253
private $configuration = [];
5354
private $driverConnection;
5455
private $schemaSynchronizer;
56+
private $schemaConfig;
5557

56-
public function __construct(array $configuration, DBALConnection $driverConnection, SchemaSynchronizer $schemaSynchronizer = null)
58+
public function __construct(array $configuration, DBALConnection $driverConnection, SchemaSynchronizer $schemaSynchronizer = null, ?SchemaConfig $schemaConfig = null)
5759
{
5860
$this->configuration = array_replace_recursive(self::DEFAULT_OPTIONS, $configuration);
5961
$this->driverConnection = $driverConnection;
6062
$this->schemaSynchronizer = $schemaSynchronizer ?? new SingleDatabaseSynchronizer($this->driverConnection);
63+
$this->schemaConfig = $schemaConfig ?? ($this->driverConnection->getSchemaManager() ? $this->driverConnection->getSchemaManager()->createSchemaConfig() : null);
6164
}
6265

6366
public function getConfiguration(): array
@@ -304,7 +307,7 @@ private function executeQuery(string $sql, array $parameters = [])
304307

305308
private function getSchema(): Schema
306309
{
307-
$schema = new Schema();
310+
$schema = new Schema([], [], $this->schemaConfig);
308311
$table = $schema->createTable($this->configuration['table_name']);
309312
$table->addColumn('id', Type::BIGINT)
310313
->setAutoincrement(true)

0 commit comments

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