<?php
namespace FMT;
use FMT\Domain\DependencyInjection\Compiler\CartProcessorPass;
use FMT\Domain\DependencyInjection\Compiler\CartProviderPass;
use FMT\Domain\DependencyInjection\Compiler\ProcessorCompilerPass;
use FMT\Infrastructure\Helper\CacheHelper;
use FMT\Infrastructure\Helper\LockHelper;
use FMT\Infrastructure\Helper\LogHelper;
use FMT\Infrastructure\Helper\NotificationHelper;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
public function boot()
{
parent::boot();
if ($this->container->has('fmt.logger')) {
LogHelper::init($this->container->get('fmt.logger'));
}
if ($this->container->has('fmt.mailer')) {
NotificationHelper::init(
$this->container->get('fmt.mailer'),
$this->container->getParameter('sender_name'),
$this->container->getParameter('sender_address')
);
}
// if ($this->container->has('fmt.cache')) {
// $prefix = null;
// if ($this->container->hasParameter('cache_prefix')) {
// $prefix = (string)$this->container->getParameter('cache_prefix');
// }
// CacheHelper::init($this->container->get('fmt.cache'), $prefix);
// }
if ($this->container->has('fmt.lock')) {
LockHelper::init($this->container->get('fmt.lock'));
}
}
protected function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new CartProviderPass());
$container->addCompilerPass(new CartProcessorPass());
$container->addCompilerPass(new ProcessorCompilerPass());
}
}