Skip to content

Commit

Permalink
bug #31625 [Messenger] Disable the SchemaAssetsFilter when setup the …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
fabpot committed May 27, 2019
2 parents 4c1df8a + 8cbb8f8 commit e19de54
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Expand Up @@ -108,7 +108,10 @@ private function getDBALConnectionMock()
$platform = $this->getMockBuilder(AbstractPlatform::class)
->getMock();
$platform->method('getWriteLockSQL')->willReturn('FOR UPDATE');
$configuration = $this->getMockBuilder(\Doctrine\DBAL\Configuration::class)
->getMock();
$driverConnection->method('getDatabasePlatform')->willReturn($platform);
$driverConnection->method('getConfiguration')->willReturn($configuration);

return $driverConnection;
}
Expand Down
18 changes: 18 additions & 0 deletions src/Symfony/Component/Messenger/Transport/Doctrine/Connection.php
Expand Up @@ -197,7 +197,25 @@ public function reject(string $id): bool

public function setup(): void
{
$configuration = $this->driverConnection->getConfiguration();
// Since Doctrine 2.9 the getFilterSchemaAssetsExpression is deprecated
$hasFilterCallback = method_exists($configuration, 'getSchemaAssetsFilter');

if ($hasFilterCallback) {
$assetFilter = $this->driverConnection->getConfiguration()->getSchemaAssetsFilter();
$this->driverConnection->getConfiguration()->setSchemaAssetsFilter(null);
} else {
$assetFilter = $this->driverConnection->getConfiguration()->getFilterSchemaAssetsExpression();
$this->driverConnection->getConfiguration()->setFilterSchemaAssetsExpression(null);
}

$this->schemaSynchronizer->updateSchema($this->getSchema(), true);

if ($hasFilterCallback) {
$this->driverConnection->getConfiguration()->setSchemaAssetsFilter($assetFilter);
} else {
$this->driverConnection->getConfiguration()->setFilterSchemaAssetsExpression($assetFilter);
}
}

public function getMessageCount(): int
Expand Down

0 comments on commit e19de54

Please sign in to comment.