src/Core/Framework/DataAbstractionLayer/Indexing/Subscriber/EntityIndexingSubscriber.php line 25

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\DataAbstractionLayer\Indexing\Subscriber;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityWrittenContainerEvent;
  4. use Shopware\Core\Framework\DataAbstractionLayer\Indexing\EntityIndexerRegistry;
  5. use Shopware\Core\Framework\Log\Package;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. /**
  8.  * @internal
  9.  */
  10. #[Package('core')]
  11. class EntityIndexingSubscriber implements EventSubscriberInterface
  12. {
  13.     public function __construct(private readonly EntityIndexerRegistry $indexerRegistry)
  14.     {
  15.     }
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [EntityWrittenContainerEvent::class => [['refreshIndex'1000]]];
  19.     }
  20.     public function refreshIndex(EntityWrittenContainerEvent $event): void
  21.     {
  22.         $this->indexerRegistry->refresh($event);
  23.     }
  24. }