Skip to content

Commit 0fed0d6

Browse files
Merge branch '3.4' into 4.4
* 3.4: [3.4] Fix support for PHP8 union types [PhpUnitBridge] Streamline ansi/no-ansi of composer according to phpunit --colors option [3.4] Small update in our internal terminology [Cache] fix compat with DBAL v3 [VarDumper] Fix CliDumper coloration [DI] tighten detection of local dirs to prevent false positives [FrameworkBundle] preserve dots in query-string when redirecting bumped Symfony version to 3.4.43 updated VERSION for 3.4.42 update CONTRIBUTORS for 3.4.42 updated CHANGELOG for 3.4.42
2 parents b2c6895 + c537472 commit 0fed0d6

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Store/PdoStore.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,26 +316,31 @@ private function getDriver(): string
316316
if ($con instanceof \PDO) {
317317
$this->driver = $con->getAttribute(\PDO::ATTR_DRIVER_NAME);
318318
} else {
319-
switch ($this->driver = $con->getDriver()->getName()) {
320-
case 'mysqli':
321-
throw new NotSupportedException(sprintf('The store "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class));
322-
case 'pdo_mysql':
323-
case 'drizzle_pdo_mysql':
319+
$driver = $con->getDriver();
320+
321+
switch (true) {
322+
case $driver instanceof \Doctrine\DBAL\Driver\Mysqli\Driver:
323+
throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class));
324+
325+
case $driver instanceof \Doctrine\DBAL\Driver\AbstractMySQLDriver:
324326
$this->driver = 'mysql';
325327
break;
326-
case 'pdo_sqlite':
328+
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver:
327329
$this->driver = 'sqlite';
328330
break;
329-
case 'pdo_pgsql':
331+
case $driver instanceof \Doctrine\DBAL\Driver\PDOPgSql\Driver:
330332
$this->driver = 'pgsql';
331333
break;
332-
case 'oci8':
333-
case 'pdo_oracle':
334+
case $driver instanceof \Doctrine\DBAL\Driver\OCI8\Driver:
335+
case $driver instanceof \Doctrine\DBAL\Driver\PDOOracle\Driver:
334336
$this->driver = 'oci';
335337
break;
336-
case 'pdo_sqlsrv':
338+
case $driver instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver:
337339
$this->driver = 'sqlsrv';
338340
break;
341+
default:
342+
$this->driver = \get_class($driver);
343+
break;
339344
}
340345
}
341346

0 commit comments

Comments
 (0)