Add user and password to dsn string

This commit is contained in:
Moritz Schröder 2015-03-11 10:38:38 +01:00
parent f34a6d28f7
commit b1b3989152

View file

@ -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'];
}