8000 bug #54392 [Messenger] Make Doctrine connection ignore unrelated tabl… · symfony/symfony@950ca75 · GitHub
[go: up one dir, main page]

Skip to content

Commit 950ca75

Browse 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

File tree

2 files changed

+2
-1
lines changed
< 8000 div id="diff-content-parent" tabindex="-1">

2 files changed

+2
-1
lines changed

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

Lines 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

Lines 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