From 7e85b4b2aea52e0b80f7f5c6b41eff4167e5a2e6 Mon Sep 17 00:00:00 2001 From: Max Kotliar Date: Tue, 8 May 2018 22:06:07 +0300 Subject: [PATCH] [mongodb] Parse DSN if array --- pkg/mongodb/MongodbConnectionFactory.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/mongodb/MongodbConnectionFactory.php b/pkg/mongodb/MongodbConnectionFactory.php index 83c405afb..1bc2c2db1 100644 --- a/pkg/mongodb/MongodbConnectionFactory.php +++ b/pkg/mongodb/MongodbConnectionFactory.php @@ -35,6 +35,7 @@ public function __construct($config = 'mongodb:') } elseif (is_string($config)) { $config = $this->parseDsn($config); } elseif (is_array($config)) { + $config = $this->parseDsn(empty($config['dsn']) ? 'mongodb:' : $config['dsn']); } else { throw new \LogicException('The config must be either an array of options, a DSN string or null'); }