From b1b3989152cf0975ef763240dc62954b7ee73691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Schr=C3=B6der?= Date: Wed, 11 Mar 2015 10:38:38 +0100 Subject: [PATCH] Add user and password to dsn string --- Command/AbstractCommand.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Command/AbstractCommand.php b/Command/AbstractCommand.php index 867d83e..b791fcf 100644 --- a/Command/AbstractCommand.php +++ b/Command/AbstractCommand.php @@ -270,6 +270,14 @@ abstract class AbstractCommand extends ContainerAwareCommand protected function getDsn($connectionName) { $connection = $this->getConnectionData($connectionName); + // Add user and password to dsn string + $dsn = explode(';', $connection['dsn']); + if (isset($connection['user'])) { + $dsn[] = 'user=' . urlencode($connection['user']); + } + if (isset($connection['password'])) { + $dsn[] = 'password=' . urlencode($connection['password']); + } return $connection['dsn']; }