src/FMT/Kernel.php line 20

Open in your IDE?
  1. <?php
  2. namespace FMT;
  3. use FMT\Domain\DependencyInjection\Compiler\CartProcessorPass;
  4. use FMT\Domain\DependencyInjection\Compiler\CartProviderPass;
  5. use FMT\Domain\DependencyInjection\Compiler\ProcessorCompilerPass;
  6. use FMT\Infrastructure\Helper\CacheHelper;
  7. use FMT\Infrastructure\Helper\LockHelper;
  8. use FMT\Infrastructure\Helper\LogHelper;
  9. use FMT\Infrastructure\Helper\NotificationHelper;
  10. use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
  11. use Symfony\Component\DependencyInjection\ContainerBuilder;
  12. use Symfony\Component\HttpKernel\Kernel as BaseKernel;
  13. class Kernel extends BaseKernel
  14. {
  15.     use MicroKernelTrait;
  16.     public function boot()
  17.     {
  18.         parent::boot();
  19.         if ($this->container->has('fmt.logger')) {
  20.             LogHelper::init($this->container->get('fmt.logger'));
  21.         }
  22.         if ($this->container->has('fmt.mailer')) {
  23.             NotificationHelper::init(
  24.                 $this->container->get('fmt.mailer'),
  25.                 $this->container->getParameter('sender_name'),
  26.                 $this->container->getParameter('sender_address')
  27.             );
  28.         }
  29. //        if ($this->container->has('fmt.cache')) {
  30. //            $prefix = null;
  31. //            if ($this->container->hasParameter('cache_prefix')) {
  32. //                $prefix = (string)$this->container->getParameter('cache_prefix');
  33. //            }
  34. //            CacheHelper::init($this->container->get('fmt.cache'), $prefix);
  35. //        }
  36.         if ($this->container->has('fmt.lock')) {
  37.             LockHelper::init($this->container->get('fmt.lock'));
  38.         }
  39.     }
  40.     protected function build(ContainerBuilder $container): void
  41.     {
  42.         $container->addCompilerPass(new CartProviderPass());
  43.         $container->addCompilerPass(new CartProcessorPass());
  44.         $container->addCompilerPass(new ProcessorCompilerPass());
  45.     }
  46. }