diff --git a/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php b/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php
index 5d31e7f0c9d..e9bc4bce6ab 100644
--- a/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php
+++ b/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php
@@ -27,12 +27,13 @@ final class ConsoleRunner
*/
public static function createHelperSet(EntityManagerInterface $entityManager): HelperSet
{
- return new HelperSet(
- [
- 'db' => new DBALConsole\Helper\ConnectionHelper($entityManager->getConnection()),
- 'em' => new EntityManagerHelper($entityManager),
- ]
- );
+ $helpers = ['em' => new EntityManagerHelper($entityManager)];
+
+ if (class_exists(DBALConsole\Helper\ConnectionHelper::class)) {
+ $helpers['db'] = new DBALConsole\Helper\ConnectionHelper($entityManager->getConnection());
+ }
+
+ return new HelperSet($helpers);
}
/**
diff --git a/phpstan-dbal3.neon b/phpstan-dbal3.neon
index 217657bd647..0133eaa63e1 100644
--- a/phpstan-dbal3.neon
+++ b/phpstan-dbal3.neon
@@ -6,3 +6,11 @@ parameters:
ignoreErrors:
# deprecations from doctrine/dbal:3.x
- '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getGuidExpression\(\).$/'
+
+ # Fallback logic for DBAL 2
+ -
+ message: '/HelperSet constructor expects/'
+ path: lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php
+ -
+ message: '/Application::add\(\) expects Symfony\\Component\\Console\\Command\\Command/'
+ path: lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 99c41303e1d..b927968d370 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -659,7 +659,6 @@
$resultSetMapping
- $resultSetMapping
return $rowData;
@@ -3560,14 +3559,11 @@
-
- DBALConsole\Command\ImportCommand::class
+
Versions::getVersion('doctrine/orm')
new Command\ConvertDoctrine1SchemaCommand()
new Command\GenerateEntitiesCommand($entityManagerProvider)
new Command\GenerateRepositoriesCommand($entityManagerProvider)
- new DBALConsole\Command\ImportCommand()
- new DBALConsole\Helper\ConnectionHelper($entityManager->getConnection())
diff --git a/psalm.xml b/psalm.xml
index 043102747d1..fd43c1b0e7a 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -16,6 +16,13 @@
+
+
+
+
+
+
+