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 950ca75

Browse filesBrowse files
committed
bug #54392 [Messenger] Make Doctrine connection ignore unrelated tables on setup (MatTheCat)
This PR was merged into the 5.4 branch. Discussion ---------- [Messenger] Make Doctrine connection ignore unrelated tables on setup | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #49108 | License | MIT Introspecting the whole database can cause issues like Doctrine crashing on unknown column types. This PR updates the schema assets filter (added by #31625) to only consider the messages table, as it is the only one a connection setup needs to care about. Commits ------- 22dab67 [Messenger] Make Doctrine connection ignore unrelated tables on setup
2 parents 93bb85e + 22dab67 commit 950ca75
Copy full SHA for 950ca75

File tree

2 files changed

+2
-1
lines changed
Filter options

2 files changed

+2
-1
lines changed

‎src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineIntegrationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineIntegrationTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public function testItRetrieveTheMessageThatIsOlderThanRedeliverTimeout()
205205

206206
public function testTheTransportIsSetupOnGet()
207207
{
208+
$this->driverConnection->executeStatement('CREATE TABLE unrelated (unknown_type_column)');
208209
$this->assertFalse($this->createSchemaManager()->tablesExist(['messenger_messages']));
209210
$this->assertNull($this->connection->get());
210211

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public function setup(): void
289289
{
290290
$configuration = $this->driverConnection->getConfiguration();
291291
$assetFilter = $configuration->getSchemaAssetsFilter();
292-
$configuration->setSchemaAssetsFilter(static function () { return true; });
292+
$configuration->setSchemaAssetsFilter(function (string $tableName) { return $tableName === $this->configuration['table_name']; });
293293
$this->updateSchema();
294294
$configuration->setSchemaAssetsFilter($assetFilter);
295295
$this->autoSetup = false;

0 commit comments

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