Skip to content

Commit 4d2679d

Browse files
committed
accept AbstractAsset instances when filtering schemas
1 parent b4f9da4 commit 4d2679d

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

Lines changed: 12 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy