custom/plugins/MegaParentProductListing/src/Subscriber/ProductIndexerSubscriber.php line 33

Open in your IDE?
  1. <?php
  2. /**
  3.  * @author Christian Reinelt <c.reinelt@mediagraphik.de>
  4.  * @copyright (c) Mediagraphik GmbH
  5.  */
  6. namespace MegaParentProductListing\Subscriber;
  7. use MegaParentProductListing\Components\Product\DataAbstractionLayer\ParentSalesUpdater;
  8. use Shopware\Core\Content\Product\Events\ProductIndexerEvent;
  9. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  10. class ProductIndexerSubscriber implements EventSubscriberInterface
  11. {
  12.     /**
  13.      * @var ParentSalesUpdater
  14.      */
  15.     private $parentSalesUpdater;
  16.     public function __construct(ParentSalesUpdater $parentSalesUpdater)
  17.     {
  18.         $this->parentSalesUpdater $parentSalesUpdater;
  19.     }
  20.     public static function getSubscribedEvents()
  21.     {
  22.         return [
  23.             ProductIndexerEvent::class => 'updateParentSales'
  24.         ];
  25.     }
  26.     public function updateParentSales(ProductIndexerEvent $event)
  27.     {
  28.         $this->parentSalesUpdater->update($event->getParentIds(),$event->getContext());
  29.     }
  30. }