diff --git a/adapters/Doctrine/DBAL/ConnectionFactory.php b/adapters/Doctrine/DBAL/ConnectionFactory.php index 314d93a..098fbec 100644 --- a/adapters/Doctrine/DBAL/ConnectionFactory.php +++ b/adapters/Doctrine/DBAL/ConnectionFactory.php @@ -44,6 +44,20 @@ public function createConnection(array $params, Configuration $config = null, Ev $slave['path'] = str_replace('__DBNAME__', $dbName, $slave['path']); } } + } elseif ('pdo_mysql' === $params['driver']) { + if (isset($params['dbname'])) { + $params['dbname'] = $this->getDbNameFromEnv($params['dbname']); + } + + if (isset($params['master']['dbname'])) { + $params['master']['dbname'] = $this->getDbNameFromEnv($params['master']['dbname']); + } + + if (!empty($params['slaves'])) { + foreach ($params['slaves'] as &$slave) { + $slave['dbname'] = $this->getDbNameFromEnv($slave['dbname']); + } + } } else { $params['dbname'] = $dbName; } diff --git a/composer.json b/composer.json index a1b3422..b0f6377 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2||^8.1", "symfony/console": "^3.4|^4.2|^5.0", "symfony/stopwatch": "^3.4|^4.2|^5.0", "symfony/process": "^3.4|^4.2|^5.0",