Skip to content

Commit

Permalink
Add kernel getter to Application for Symfony console commands to work
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierstoval authored and trasher committed Nov 14, 2024
1 parent 8d69d1f commit a02669e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Glpi/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
}

0 comments on commit a02669e

Please sign in to comment.