8000 access AbstractAsset instances when filtering schemas · symfony/symfony@2b651ad · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b651ad

Browse files
committed
access AbstractAsset instances when filtering schemas
1 parent b4f9da4 commit 2b651ad

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