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

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. /**
  8.  * @deprecated tag:v6.5.0 - reason:becomes-internal - EventSubscribers will become internal in v6.5.0
  9.  */
  10. class ProductUpdater implements EventSubscriberInterface
  11. {
  12.     private ElasticsearchIndexer $indexer;
  13.     private EntityDefinition $definition;
  14.     /**
  15.      * @internal
  16.      */
  17.     public function __construct(ElasticsearchIndexer $indexerEntityDefinition $definition)
  18.     {
  19.         $this->indexer $indexer;
  20.         $this->definition $definition;
  21.     }
  22.     /**
  23.      * @return array<string, string|array{0: string, 1: int}|list<array{0: string, 1?: int}>>
  24.      */
  25.     public static function getSubscribedEvents()
  26.     {
  27.         return [
  28.             ProductIndexerEvent::class => 'update',
  29.         ];
  30.     }
  31.     public function update(ProductIndexerEvent $event): void
  32.     {
  33.         $this->indexer->updateIds($this->definition$event->getIds());
  34.     }
  35. }