Skip to content

Commit 363eec2

Browse files
bug #37342 [Cache] fix compat with DBAL v3 (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [Cache] fix compat with DBAL v3 | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 8c4b496 [Cache] fix compat with DBAL v3
2 parents b30f4c1 + 8c4b496 commit 363eec2

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/Symfony/Component/Cache/Traits/PdoTrait.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,25 +366,31 @@ private function getConnection()
366366
if ($this->conn instanceof \PDO) {
367367
$this->driver = $this->conn->getAttribute(\PDO::ATTR_DRIVER_NAME);
368368
} else {
369-
switch ($this->driver = $this->conn->getDriver()->getName()) {
370-
case 'mysqli':
371-
case 'pdo_mysql':
372-
case 'drizzle_pdo_mysql':
369+
$driver = $this->conn->getDriver();
370+
371+
switch (true) {
372+
case $driver instanceof \Doctrine\DBAL\Driver\AbstractMySQLDriver:
373+
case $driver instanceof \Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver:
374+
case $driver instanceof \Doctrine\DBAL\Driver\Mysqli\Driver:
375+
case $driver instanceof \Doctrine\DBAL\Driver\PDOMySql\Driver:
373376
$this->driver = 'mysql';
374377
break;
375-
case 'pdo_sqlite':
378+
case $driver instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver:
376379
$this->driver = 'sqlite';
377380
break;
378-
case 'pdo_pgsql':
381+
case $driver instanceof \Doctrine\DBAL\Driver\PDOPgSql\Driver:
379382
$this->driver = 'pgsql';
380383
break;
381-
case 'oci8':
382-
case 'pdo_oracle':
384+
case $driver instanceof \Doctrine\DBAL\Driver\OCI8\Driver:
385+
case $driver instanceof \Doctrine\DBAL\Driver\PDOOracle\Driver:
383386
$this->driver = 'oci';
384387
break;
385-
case 'pdo_sqlsrv':
388+
case $driver instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver:
386389
$this->driver = 'sqlsrv';
387390
break;
391+
default:
392+
$this->driver = \get_class($driver);
393+
break;
388394
}
389395
}
390396
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy