<?php declare(strict_types=1);
namespace Shopware\Core\Framework\DataAbstractionLayer\Indexing\Subscriber;
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent;
use Shopware\Core\Framework\DataAbstractionLayer\Indexing\EntityIndexerRegistry;
use Shopware\Core\Framework\Log\Package;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* @internal
*/
#[Package('core')]
class EntityIndexingSubscriber implements EventSubscriberInterface
{
private EntityIndexerRegistry $indexerRegistry;
public function __construct(EntityIndexerRegistry $indexerRegistry)
{
$this->indexerRegistry = $indexerRegistry;
}
public static function getSubscribedEvents(): array
{
return [EntityWrittenContainerEvent::class => [['refreshIndex', 1000]]];
}
public function refreshIndex(EntityWrittenContainerEvent $event): void
{
$this->indexerRegistry->refresh($event);
}
}