Skip to content

Commit

Permalink
Fix url resolution for master/slave connections
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed Aug 9, 2018
1 parent 66daecd commit d4d6ea3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/Doctrine/DBAL/DriverManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,17 @@ public static function getConnection(
$eventManager = new EventManager();
}

$params = self::parseDatabaseUrl($params);
if (isset($params['master'])) {
$params['master'] = self::parseDatabaseUrl($params['master']);

if (isset($params['slaves'])) {
foreach ($params['slaves'] as $slaveName => $slaveParams) {
$params['slaves'][$slaveName] = self::parseDatabaseUrl($slaveParams);
}
}
} else {
$params = self::parseDatabaseUrl($params);
}

// check for existing pdo object
if (isset($params['pdo']) && ! $params['pdo'] instanceof \PDO) {
Expand Down

0 comments on commit d4d6ea3

Please sign in to comment.