custom/plugins/CioCustomerPermissionGroups/src/Subscriber/ContainerSubscriber.php line 30

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace CioCustomerPermissionGroups\Subscriber;
  3. use CioCustomerPermissionGroups\Utils\ContainerUtility;
  4. use Symfony\Component\Console\ConsoleEvents;
  5. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  6. use Symfony\Component\DependencyInjection\ContainerInterface;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. use Symfony\Component\HttpKernel\Event\RequestEvent;
  9. use Symfony\Component\HttpKernel\KernelEvents;
  10. class ContainerSubscriber implements EventSubscriberInterface
  11. {
  12.     /**
  13.      * CIO-AI-Driven
  14.      */
  15.     private ContainerInterface $container;
  16.     public function __construct(ContainerInterface $container)
  17.     {
  18.         $this->container $container;
  19.     }
  20.     public function onKernelRequest(RequestEvent $requestEvent): void
  21.     {
  22.         ContainerUtility::setContainer($this->container);
  23.     }
  24.     public function onConsoleCommand(ConsoleCommandEvent $event): void
  25.     {
  26.         ContainerUtility::setContainer($this->container);
  27.     }
  28.     public static function getSubscribedEvents(): array
  29.     {
  30.         return [
  31.             KernelEvents::REQUEST => 'onKernelRequest',
  32.             ConsoleEvents::COMMAND => 'onConsoleCommand',
  33.         ];
  34.     }
  35. }