diff --git a/src/Glpi/Console/Application.php b/src/Glpi/Console/Application.php index f5edd4a6abc..018b1a058ae 100644 --- a/src/Glpi/Console/Application.php +++ b/src/Glpi/Console/Application.php @@ -59,6 +59,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\HttpKernel\KernelInterface; use Toolbox; use Update; @@ -618,4 +619,18 @@ public function extractNamespace(string $name, ?int $limit = null): string return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit)); } + + /** + * Gets the Kernel associated with this Console. + * + * This method is required by most of the commands provided by the `symfony/framework-bundle`. + * @see \Symfony\Bundle\FrameworkBundle\Console\Application::getKernel() + */ + public function getKernel(): ?KernelInterface + { + /** @var KernelInterface|null $kernel */ + global $kernel; + + return $kernel; + } }