@@ -108,7 +108,7 @@ public function getConnection(string $type, array $additionalConnectionParams):
108108 $ normalizedType = $ this ->normalizeType ($ type );
109109 $ eventManager = new EventManager ();
110110 $ eventManager ->addEventSubscriber (new SetTransactionIsolationLevel ());
111- $ connectionParams = $ this ->createConnectionParams ('' , $ additionalConnectionParams );
111+ $ connectionParams = $ this ->createConnectionParams ('' , $ additionalConnectionParams, $ type );
112112 switch ($ normalizedType ) {
113113 case 'pgsql ' :
114114 // pg_connect used by Doctrine DBAL does not support URI notation (enclosed in brackets)
@@ -175,12 +175,10 @@ public function isValidType($type) {
175175
176176 /**
177177 * Create the connection parameters for the config
178- *
179- * @param string $configPrefix
180- * @return array
181178 */
182- public function createConnectionParams (string $ configPrefix = '' , array $ additionalConnectionParams = []) {
183- $ type = $ this ->config ->getValue ('dbtype ' , 'sqlite ' );
179+ public function createConnectionParams (string $ configPrefix = '' , array $ additionalConnectionParams = [], ?string $ type = null ) {
180+ // use provided type or if null use type from config
181+ $ type = $ type ?? $ this ->config ->getValue ('dbtype ' , 'sqlite ' );
184182
185183 $ connectionParams = array_merge ($ this ->getDefaultConnectionParams ($ type ), [
186184 'user ' => $ this ->config ->getValue ($ configPrefix . 'dbuser ' , $ this ->config ->getValue ('dbuser ' , '' )),
@@ -212,7 +210,7 @@ public function createConnectionParams(string $configPrefix = '', array $additio
212210 'tablePrefix ' => $ connectionParams ['tablePrefix ' ]
213211 ];
214212
215- if ($ this ->config ->getValue ('mysql.utf8mb4 ' , false )) {
213+ if ($ type === ' mysql ' && $ this ->config ->getValue ('mysql.utf8mb4 ' , false )) {
216214 $ connectionParams ['defaultTableOptions ' ] = [
217215 'collate ' => 'utf8mb4_bin ' ,
218216 'charset ' => 'utf8mb4 ' ,
0 commit comments