Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
replace deprecated platforms instead of throw
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Dec 1, 2020
1 parent f1e2779 commit 2e0cede
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,25 @@ protected static function connectDbalConnection(array $dsn)
// https://github.com/doctrine/dbal/pull/3912
// TODO drop once DBAL 2.x support is dropped
if (
(in_array(get_class($dbalConnection->getDatabasePlatform()), [
in_array(get_class($dbalConnection->getDatabasePlatform()), [
'Doctrine\DBAL\Platforms\SQLServerPlatform',
'Doctrine\DBAL\Platforms\SQLServer2005Platform',
'Doctrine\DBAL\Platforms\SQLServer2008Platform',
], true) && !($dbalConnection->getDatabasePlatform() instanceof SQLServer2012Platform))
|| (in_array(get_class($dbalConnection->getDatabasePlatform()), [
], true) && !($dbalConnection->getDatabasePlatform() instanceof SQLServer2012Platform)
) {
\Closure::bind(function () use ($dbalConnection) {
$dbalConnection->platform = new SQLServer2012Platform();
}, null, DbalConnection::class)();
} elseif (
in_array(get_class($dbalConnection->getDatabasePlatform()), [
'Doctrine\DBAL\Platforms\PostgreSqlPlatform',
'Doctrine\DBAL\Platforms\PostgreSQL91Platform',
'Doctrine\DBAL\Platforms\PostgreSQL92Platform',
], true) && !($dbalConnection->getDatabasePlatform() instanceof PostgreSQL94Platform))
], true) && !($dbalConnection->getDatabasePlatform() instanceof PostgreSQL94Platform)
) {
throw (new Exception('Database server version is not supported'))
->addMoreInfo('platform_class', get_class($dbalConnection->getDatabasePlatform()));
\Closure::bind(function () use ($dbalConnection) {
$dbalConnection->platform = new PostgreSQL94Platform();
}, null, DbalConnection::class)();
}

// Oracle CLOB/BLOB has limited SQL support, see:
Expand Down

0 comments on commit 2e0cede

Please sign in to comment.