<?php
namespace App\EventSubscriber;
use App\Utils\TimezoneInjection\TimezoneInjector;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
class TZInjectInitSubscriber implements EventSubscriberInterface
{
/**
* @var TimezoneInjector
*/
private $timezoneInjectable;
/**
* TZInjectInitSubscriber constructor.
* This class is a hack to initiate TimezoneInjector instance for the whole application.
*/
public function __construct(TimezoneInjector $timezoneInjectable)
{
$this->timezoneInjectable = $timezoneInjectable;
}
/**
* @param $event
*/
public function onStart($event)
{
}
public static function getSubscribedEvents()
{
return [
KernelEvents::REQUEST => ['onStart', -100],
ConsoleEvents::COMMAND => ['onStart', -100],
];
}
}