ArrayParameters
2 years ago
Cache
9 months ago
Driver
9 months ago
Event
2 years ago
Exception
9 months ago
Id
2 years ago
Logging
2 years ago
Platforms
9 months ago
Portability
2 years ago
Query
2 years ago
SQL
9 months ago
Schema
8 months ago
Types
9 months ago
ArrayParameterType.php
2 years ago
ColumnCase.php
2 years ago
Configuration.php
9 months ago
Connection.php
9 months ago
ConnectionException.php
2 years ago
Driver.php
2 years ago
DriverManager.php
2 years ago
Events.php
2 years ago
Exception.php
2 years ago
ExpandArrayParameters.php
2 years ago
FetchMode.php
2 years ago
LockMode.php
2 years ago
ParameterType.php
2 years ago
Query.php
2 years ago
Result.php
2 years ago
Statement.php
2 years ago
TransactionIsolationLevel.php
2 years ago
VersionAwarePlatformDriver.php
2 years ago
index.php
2 years ago
Configuration.php
117 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Doctrine\DBAL; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Doctrine\Common\Cache\Cache; |
| 5 | use MailPoetVendor\Doctrine\Common\Cache\Psr6\CacheAdapter; |
| 6 | use MailPoetVendor\Doctrine\Common\Cache\Psr6\DoctrineProvider; |
| 7 | use MailPoetVendor\Doctrine\DBAL\Driver\Middleware; |
| 8 | use MailPoetVendor\Doctrine\DBAL\Logging\SQLLogger; |
| 9 | use MailPoetVendor\Doctrine\DBAL\Schema\SchemaManagerFactory; |
| 10 | use MailPoetVendor\Doctrine\Deprecations\Deprecation; |
| 11 | use MailPoetVendor\Psr\Cache\CacheItemPoolInterface; |
| 12 | use RuntimeException; |
| 13 | use function class_exists; |
| 14 | use function func_num_args; |
| 15 | use function interface_exists; |
| 16 | use function sprintf; |
| 17 | class Configuration |
| 18 | { |
| 19 | private array $middlewares = []; |
| 20 | protected $sqlLogger; |
| 21 | private ?CacheItemPoolInterface $resultCache = null; |
| 22 | protected $resultCacheImpl; |
| 23 | protected $schemaAssetsFilter; |
| 24 | protected $autoCommit = \true; |
| 25 | private bool $disableTypeComments = \false; |
| 26 | private ?SchemaManagerFactory $schemaManagerFactory = null; |
| 27 | public function __construct() |
| 28 | { |
| 29 | $this->schemaAssetsFilter = static function () : bool { |
| 30 | return \true; |
| 31 | }; |
| 32 | } |
| 33 | public function setSQLLogger(?SQLLogger $logger = null) : void |
| 34 | { |
| 35 | Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4967', '%s is deprecated, use setMiddlewares() and Logging\\Middleware instead.', __METHOD__); |
| 36 | $this->sqlLogger = $logger; |
| 37 | } |
| 38 | public function getSQLLogger() : ?SQLLogger |
| 39 | { |
| 40 | Deprecation::triggerIfCalledFromOutside('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4967', '%s is deprecated.', __METHOD__); |
| 41 | return $this->sqlLogger; |
| 42 | } |
| 43 | public function getResultCache() : ?CacheItemPoolInterface |
| 44 | { |
| 45 | return $this->resultCache; |
| 46 | } |
| 47 | public function getResultCacheImpl() : ?Cache |
| 48 | { |
| 49 | Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4620', '%s is deprecated, call getResultCache() instead.', __METHOD__); |
| 50 | if ($this->resultCache !== null && !interface_exists(Cache::class)) { |
| 51 | throw new RuntimeException(sprintf('Calling %s() is not supported if the doctrine/cache package is not installed. ' . 'Try running "composer require doctrine/cache" or migrate cache access to PSR-6.', __METHOD__)); |
| 52 | } |
| 53 | return $this->resultCacheImpl; |
| 54 | } |
| 55 | public function setResultCache(CacheItemPoolInterface $cache) : void |
| 56 | { |
| 57 | if (class_exists(DoctrineProvider::class)) { |
| 58 | $this->resultCacheImpl = DoctrineProvider::wrap($cache); |
| 59 | } |
| 60 | $this->resultCache = $cache; |
| 61 | } |
| 62 | public function setResultCacheImpl(Cache $cacheImpl) : void |
| 63 | { |
| 64 | Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4620', '%s is deprecated, call setResultCache() instead.', __METHOD__); |
| 65 | $this->resultCacheImpl = $cacheImpl; |
| 66 | $this->resultCache = CacheAdapter::wrap($cacheImpl); |
| 67 | } |
| 68 | public function setSchemaAssetsFilter(?callable $callable = null) : void |
| 69 | { |
| 70 | if (func_num_args() < 1) { |
| 71 | Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5483', 'Not passing an argument to %s is deprecated.', __METHOD__); |
| 72 | } elseif ($callable === null) { |
| 73 | Deprecation::trigger('doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5483', 'Using NULL as a schema asset filter is deprecated.' . ' Use a callable that always returns true instead.'); |
| 74 | } |
| 75 | $this->schemaAssetsFilter = $callable; |
| 76 | } |
| 77 | public function getSchemaAssetsFilter() : ?callable |
| 78 | { |
| 79 | return $this->schemaAssetsFilter; |
| 80 | } |
| 81 | public function setAutoCommit(bool $autoCommit) : void |
| 82 | { |
| 83 | $this->autoCommit = $autoCommit; |
| 84 | } |
| 85 | public function getAutoCommit() : bool |
| 86 | { |
| 87 | return $this->autoCommit; |
| 88 | } |
| 89 | public function setMiddlewares(array $middlewares) : self |
| 90 | { |
| 91 | $this->middlewares = $middlewares; |
| 92 | return $this; |
| 93 | } |
| 94 | public function getMiddlewares() : array |
| 95 | { |
| 96 | return $this->middlewares; |
| 97 | } |
| 98 | public function getSchemaManagerFactory() : ?SchemaManagerFactory |
| 99 | { |
| 100 | return $this->schemaManagerFactory; |
| 101 | } |
| 102 | public function setSchemaManagerFactory(SchemaManagerFactory $schemaManagerFactory) : self |
| 103 | { |
| 104 | $this->schemaManagerFactory = $schemaManagerFactory; |
| 105 | return $this; |
| 106 | } |
| 107 | public function getDisableTypeComments() : bool |
| 108 | { |
| 109 | return $this->disableTypeComments; |
| 110 | } |
| 111 | public function setDisableTypeComments(bool $disableTypeComments) : self |
| 112 | { |
| 113 | $this->disableTypeComments = $disableTypeComments; |
| 114 | return $this; |
| 115 | } |
| 116 | } |
| 117 |