From 4e7329cd41824a6614b88eb27f5fa5b5c9d93109 Mon Sep 17 00:00:00 2001 From: Julien Deniau Date: Wed, 7 Oct 2020 10:36:53 +0200 Subject: [PATCH 1/2] handle mysql master / slave connection --- adapters/Doctrine/DBAL/ConnectionFactory.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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; } From 9d32bf0f74fbaa1f3dd93289ab4479c2cbadffe1 Mon Sep 17 00:00:00 2001 From: Julien Date: Mon, 17 Oct 2022 21:26:57 +0200 Subject: [PATCH 2/2] php 8 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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",