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.     /**
  10.      * @var ElasticsearchIndexer
  11.      */
  12.     private $indexer;
  13.     /**
  14.      * @var EntityDefinition
  15.      */
  16.     private $definition;
  17.     public function __construct(ElasticsearchIndexer $indexerEntityDefinition $definition)
  18.     {
  19.         $this->indexer $indexer;
  20.         $this->definition $definition;
  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->sendIndexingMessages(
  31.             $this->definition,
  32.             array_merge($event->getIds(), $event->getChildrenIds())
  33.         );
  34.     }
  35. }