<?php
namespace App\EventSubscriber;
use App\Adapter\KalturaAdapter;
use App\Event\SettingsSavedEvent;
use App\Form\Setting\MultiMediaKalturaSettingType;
use App\Manager\MultiMediaManager;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class KalturaEventSubscriber implements EventSubscriberInterface
{
protected MultiMediaManager $multiMediaManager;
public function __construct(MultiMediaManager $multiMediaManager)
{
$this->multiMediaManager = $multiMediaManager;
}
public static function getSubscribedEvents(): array
{
return [
SettingsSavedEvent::class => 'settingsSaved',
];
}
public function settingsSaved(SettingsSavedEvent $event)
{
if (MultiMediaKalturaSettingType::class !== \get_class($event->getType())) {
return;
}
$this->multiMediaManager->rebuildMultimediaItems(KalturaAdapter::KEY);
$event->stopPropagation();
}
}