Skip to content

Commit 4a96721

Browse files
committed
bug #31625 [Messenger] Disable the SchemaAssetsFilter when setup the transport (vincenttouzet)
This PR was merged into the 4.3 branch. Discussion ---------- [Messenger] Disable the SchemaAssetsFilter when setup the transport | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #31623 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Commits ------- 8cbb8f89ad [Messenger] Disable the SchemaAssetsFilter when setup the transport
2 parents 46591c4 + 40a0b25 commit 4a96721

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Tests/Transport/Doctrine/ConnectionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ private function getDBALConnectionMock()
108108
$platform = $this->getMockBuilder(AbstractPlatform::class)
109109
->getMock();
110110
$platform->method('getWriteLockSQL')->willReturn('FOR UPDATE');
111+
$configuration = $this->getMockBuilder(\Doctrine\DBAL\Configuration::class)
112+
->getMock();
111113
$driverConnection->method('getDatabasePlatform')->willReturn($platform);
114+
$driverConnection->method('getConfiguration')->willReturn($configuration);
112115

113116
return $driverConnection;
114117
}

Transport/Doctrine/Connection.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,25 @@ public function reject(string $id): bool
197197

198198
public function setup(): void
199199
{
200+
$configuration = $this->driverConnection->getConfiguration();
201+
// Since Doctrine 2.9 the getFilterSchemaAssetsExpression is deprecated
202+
$hasFilterCallback = method_exists($configuration, 'getSchemaAssetsFilter');
203+
204+
if ($hasFilterCallback) {
205+
$assetFilter = $this->driverConnection->getConfiguration()->getSchemaAssetsFilter();
206+
$this->driverConnection->getConfiguration()->setSchemaAssetsFilter(null);
207+
} else {
208+
$assetFilter = $this->driverConnection->getConfiguration()->getFilterSchemaAssetsExpression();
209+
$this->driverConnection->getConfiguration()->setFilterSchemaAssetsExpression(null);
210+
}
211+
200212
$this->schemaSynchronizer->updateSchema($this->getSchema(), true);
213+
214+
if ($hasFilterCallback) {
215+
$this->driverConnection->getConfiguration()->setSchemaAssetsFilter($assetFilter);
216+
} else {
217+
$this->driverConnection->getConfiguration()->setFilterSchemaAssetsExpression($assetFilter);
218+
}
201219
}
202220

203221
public function getMessageCount(): int

0 commit comments

Comments
 (0)