This commit is contained in:
Marek
2026-03-24 00:04:55 +01:00
commit c5229e48ed
4225 changed files with 511461 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace Doctrine\Bundle\DoctrineBundle\Dbal;
use Doctrine\DBAL\Schema\AbstractAsset;
use function in_array;
/** @deprecated Implement your own include/exclude mechanism */
class BlacklistSchemaAssetFilter
{
/** @param string[] $blacklist */
public function __construct(
private readonly array $blacklist,
) {
}
/** @param string|AbstractAsset $assetName */
public function __invoke($assetName): bool
{
if ($assetName instanceof AbstractAsset) {
$assetName = $assetName->getName();
}
return ! in_array($assetName, $this->blacklist, true);
}
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Doctrine\Bundle\DoctrineBundle\Dbal;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Tools\Console\ConnectionProvider;
use Doctrine\Persistence\AbstractManagerRegistry;
class ManagerRegistryAwareConnectionProvider implements ConnectionProvider
{
public function __construct(
private readonly AbstractManagerRegistry $managerRegistry,
) {
}
public function getDefaultConnection(): Connection
{
return $this->managerRegistry->getConnection();
}
public function getConnection(string $name): Connection
{
return $this->managerRegistry->getConnection($name);
}
}

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Doctrine\Bundle\DoctrineBundle\Dbal;
use Doctrine\DBAL\Schema\AbstractAsset;
use function preg_match;
class RegexSchemaAssetFilter
{
public function __construct(
private readonly string $filterExpression,
) {
}
public function __invoke(string|AbstractAsset $assetName): bool
{
if ($assetName instanceof AbstractAsset) {
$assetName = $assetName->getName();
}
return (bool) preg_match($this->filterExpression, $assetName);
}
}

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Doctrine\Bundle\DoctrineBundle\Dbal;
use Doctrine\DBAL\Schema\AbstractAsset;
/**
* Manages schema filters passed to Connection::setSchemaAssetsFilter()
*/
class SchemaAssetsFilterManager
{
/** @param callable[] $schemaAssetFilters */
public function __construct(
private readonly array $schemaAssetFilters,
) {
}
/** @param string|AbstractAsset $assetName */
public function __invoke($assetName): bool
{
foreach ($this->schemaAssetFilters as $schemaAssetFilter) {
if ($schemaAssetFilter($assetName) === false) {
return false;
}
}
return true;
}
}