From cf0a55e1074116612823b6fa24902c73387d8c53 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Fri, 5 Jul 2024 14:59:21 +0200 Subject: [PATCH] Add compatibility to doctrine/dbal 2 --- .gitignore | 1 + composer.json | 4 ++-- tests/Oro/Tests/Connection/TestUtil.php | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 912ac3bf71a..6b3066e7a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ phpunit.xml vendor/ composer.lock +.phpunit.cache/ .idea/ diff --git a/composer.json b/composer.json index f4829593131..945504fa6ec 100644 --- a/composer.json +++ b/composer.json @@ -15,10 +15,10 @@ "php": ">=8.1", "doctrine/lexer": "^2.0|^3.0", "doctrine/orm": "^2.19|^3.0", - "doctrine/dbal": "^3.3|^4.0" + "doctrine/dbal": "^2.13|^3.3|^4.0" }, "require-dev": { - "phpunit/phpunit": "~10", + "phpunit/phpunit": "^10|^11", "doctrine/data-fixtures": "^1.6", "symfony/yaml": "^5|^6|^7", "symfony/cache": "^5|^6|^7", diff --git a/tests/Oro/Tests/Connection/TestUtil.php b/tests/Oro/Tests/Connection/TestUtil.php index 162a71701d0..0a218aeecac 100644 --- a/tests/Oro/Tests/Connection/TestUtil.php +++ b/tests/Oro/Tests/Connection/TestUtil.php @@ -78,6 +78,11 @@ public static function getPlatformName(): string $platform = $entityManager->getConnection()->getDatabasePlatform(); + if (\method_exists($platform, 'getName')) { + // BC Layer for doctrine/dbal 2 can be removed when require doctrine/dbal 3 as min version + return $platform->getName(); + } + if ($platform instanceof AbstractMySQLPlatform) { return 'mysql'; } elseif ($platform instanceof PostgreSQLPlatform) {