8000 bug #54775 [Messenger] accept AbstractAsset instances when filtering … · symfony/symfony@c1ca4ca · GitHub
[go: up one dir, main page]

Skip to content

Commit c1ca4ca

Browse files
committed
bug #54775 [Messenger] accept AbstractAsset instances when filtering schemas (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [Messenger] accept AbstractAsset instances when filtering schemas | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #54769 | License | MIT Commits ------- 4d2679d accept AbstractAsset instances when filtering schemas
2 parents 6be16ad + 4d2679d commit c1ca4ca

File tree

1 file changed

+12
-1
lines changed
  • src/Symfony/Component/Messenger/Bridge/Doctrine/Transport

1 file changed

+12
-1
lines changed

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Doctrine\DBAL\Platforms\OraclePlatform;
2222
use Doctrine\DBAL\Query\QueryBuilder;
2323
use Doctrine\DBAL\Result;
24+
use Doctrine\DBAL\Schema\AbstractAsset;
2425
use Doctrine\DBAL\Schema\AbstractSchemaManager;
2526
use Doctrine\DBAL\Schema\Comparator;
2627
use Doctrine\DBAL\Schema\Schema;
@@ -289,7 +290,17 @@ public function setup(): void
289290
{
290291
$configuration = $this->driverConnection->getConfiguration();
291292
$assetFilter = $configuration->getSchemaAssetsFilter();
292-
$configuration->setSchemaAssetsFilter(function (string $tableName) { return $tableName === $this->configuration['table_name']; });
293+
$configuration->setSchemaAssetsFilter(function ($tableName) {
294+
if ($tableName instanceof AbstractAsset) {
295+
$tableName = $tableName->getName();
296+
}
297+
298+
if (!\is_string($tableName)) {
299+
throw new \TypeError(sprintf('The table name must be an instance of "%s" or a string ("%s" given).', AbstractAsset::class, get_debug_type($tableName)));
300+
}
301+
302+
return $tableName === $this->configuration['table_name'];
303+
});
293304
$this->updateSchema();
294305
$configuration->setSchemaAssetsFilter($assetFilter);
295306
$this->autoSetup = false;

0 commit comments

Comments
 (0)
0