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 e19de54

Browse filesBrowse 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 ------- 8cbb8f8 [Messenger] Disable the SchemaAssetsFilter when setup the transport
2 parents 4c1df8a + 8cbb8f8 commit e19de54
Copy full SHA for e19de54

File tree

2 files changed

+21
-0
lines changed
Filter options

2 files changed

+21
-0
lines changed

‎src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Tests/Transport/Doctrine/ConnectionTest.php
+3Lines 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
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php
+18Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.