<?php
/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);
namespace Ibexa\HttpCache\EventSubscriber\CachePurge;
use Ibexa\Contracts\Core\Repository\Events\Content\DeleteTranslationEvent;
final class TranslationEventsSubscriber extends AbstractSubscriber
{
public static function getSubscribedEvents(): array
{
return [
DeleteTranslationEvent::class => 'onDeleteTranslation',
];
}
public function onDeleteTranslation(DeleteTranslationEvent $event): void
{
$contentId = $event->getContentInfo()->id;
$tags = array_merge(
$this->getContentTags($contentId),
$this->getContentLocationsTags($contentId)
);
$this->purgeClient->purge($tags);
}
}
class_alias(TranslationEventsSubscriber::class, 'EzSystems\PlatformHttpCacheBundle\EventSubscriber\CachePurge\TranslationEventsSubscriber');