@@ -120,7 +120,7 @@ public function getConnection(string $type, array $additionalConnectionParams):
120120 $ normalizedType = $ this ->normalizeType ($ type );
121121 $ eventManager = new EventManager ();
122122 $ eventManager ->addEventSubscriber (new SetTransactionIsolationLevel ());
123- $ connectionParams = $ this ->createConnectionParams ('' , $ additionalConnectionParams );
123+ $ connectionParams = $ this ->createConnectionParams ('' , $ additionalConnectionParams, $ type );
124124 switch ($ normalizedType ) {
125125 case 'pgsql ' :
126126 // pg_connect used by Doctrine DBAL does not support URI notation (enclosed in brackets)
@@ -187,12 +187,10 @@ public function isValidType($type) {
187187
188188 /**
189189 * Create the connection parameters for the config
190- *
191- * @param string $configPrefix
192- * @return array
193190 */
194- public function createConnectionParams (string $ configPrefix = '' , array $ additionalConnectionParams = []) {
195- $ type = $ this ->config ->getValue ('dbtype ' , 'sqlite ' );
191+ public function createConnectionParams (string $ configPrefix = '' , array $ additionalConnectionParams = [], ?string $ type = null ) {
192+ // use provided type or if null use type from config
193+ $ type = $ type ?? $ this ->config ->getValue ('dbtype ' , 'sqlite ' );
196194
197195 $ connectionParams = array_merge ($ this ->getDefaultConnectionParams ($ type ), [
198196 'user ' => $ this ->config ->getValue ($ configPrefix . 'dbuser ' , $ this ->config ->getValue ('dbuser ' , '' )),
@@ -224,7 +222,7 @@ public function createConnectionParams(string $configPrefix = '', array $additio
224222 'tablePrefix ' => $ connectionParams ['tablePrefix ' ]
225223 ];
226224
227- if ($ this ->config ->getValue ('mysql.utf8mb4 ' , false )) {
225+ if ($ type === ' mysql ' && $ this ->config ->getValue ('mysql.utf8mb4 ' , false )) {
228226 $ connectionParams ['defaultTableOptions ' ] = [
229227 'collate ' => 'utf8mb4_bin ' ,
230228 'charset ' => 'utf8mb4 ' ,
0 commit comments