vendor/shopware/elasticsearch/Product/ProductUpdater.php line 35

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Elasticsearch\Product;
  3. use Shopware\Core\Content\Product\Events\ProductIndexerEvent;
  4. use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
  5. use Shopware\Elasticsearch\Framework\Indexing\ElasticsearchIndexer;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class ProductUpdater implements EventSubscriberInterface
  8. {
  9.     private ElasticsearchIndexer $indexer;
  10.     private EntityDefinition $definition;
  11.     /**
  12.      * @internal
  13.      */
  14.     public function __construct(ElasticsearchIndexer $indexerEntityDefinition $definition)
  15.     {
  16.         $this->indexer $indexer;
  17.         $this->definition $definition;
  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.             ProductIndexerEvent::class => 'update',
  26.         ];
  27.     }
  28.     public function update(ProductIndexerEvent $event): void
  29.     {
  30.         $this->indexer->updateIds($this->definition$event->getIds());
  31.     }
  32. }