vendor/shopware/elasticsearch/Admin/Subscriber/RefreshIndexSubscriber.php line 34

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Elasticsearch\Admin\Subscriber;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Event\RefreshIndexEvent;
  4. use Shopware\Core\Framework\Log\Package;
  5. use Shopware\Elasticsearch\Admin\AdminIndexingBehavior;
  6. use Shopware\Elasticsearch\Admin\AdminSearchRegistry;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. /**
  9. * @internal
  10. */
  11. #[Package('system-settings')]
  12. final class RefreshIndexSubscriber implements EventSubscriberInterface
  13. {
  14. private AdminSearchRegistry $registry;
  15. public function __construct(AdminSearchRegistry $registry)
  16. {
  17. $this->registry = $registry;
  18. }
  19. /**
  20. * @return array<string, string|array{0: string, 1: int}|list<array{0: string, 1?: int}>>
  21. */
  22. public static function getSubscribedEvents()
  23. {
  24. return [
  25. RefreshIndexEvent::class => 'handled',
  26. ];
  27. }
  28. public function handled(RefreshIndexEvent $event): void
  29. {
  30. $this->registry->iterate(
  31. new AdminIndexingBehavior(
  32. $event->getNoQueue(),
  33. $event->getSkipEntities(),
  34. $event->getOnlyEntities()
  35. )
  36. );
  37. }
  38. }