init
This commit is contained in:
commit
c5229e48ed
4225 files changed
+511461
No files matched your search
+29
@@ -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);
|
||||
}
|
||||
}
|
||||
Vendored
+27
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
+31
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user