diff --git a/src/Command/InfoCommand.php b/src/Command/InfoCommand.php index 9c0a3197e..5261aa94d 100644 --- a/src/Command/InfoCommand.php +++ b/src/Command/InfoCommand.php @@ -54,10 +54,22 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->text([$message, '']); - $platform = $this->doctrineVersion->getPlatform(); + try { + $platform = $this->doctrineVersion->getPlatform(); + $tableExists = $this->doctrineVersion->tableContentExists() ? '' : sprintf(' - Tables not initialised'); + $withJson = $this->doctrineVersion->hasJson() ? 'with JSON' : 'without JSON'; + } catch (\Throwable $e) { + $platform = [ + 'client_version' => '', + 'driver_name' => 'Unknown - no database connection', + 'connection_status' => '', + 'server_version' => '', + ]; + $tableExists = ''; + $withJson = ''; + } + $connection = ! empty($platform['connection_status']) ? sprintf(' - %s', $platform['connection_status']) : ''; - $tableExists = $this->doctrineVersion->tableContentExists() ? '' : sprintf(' - Tables not initialised'); - $withJson = $this->doctrineVersion->hasJson() ? 'with JSON' : 'without JSON'; $io->listing([ sprintf('Install type: %s', Version::installType()),