vendor/shopware/storefront/Event/BackwardSubscriber.php line 45

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Storefront\Event;
  3. use Shopware\Core\Content\Product\Events\ProductCrossSellingIdsCriteriaEvent;
  4. use Shopware\Core\Content\Product\Events\ProductCrossSellingStreamCriteriaEvent;
  5. use Shopware\Storefront\Page\Product\CrossSelling\CrossSellingProductListCriteriaEvent;
  6. use Shopware\Storefront\Page\Product\CrossSelling\CrossSellingProductStreamCriteriaEvent;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
  9. class BackwardSubscriber implements EventSubscriberInterface
  10. {
  11.     /**
  12.      * @var EventDispatcherInterface
  13.      */
  14.     private $eventDispatcher;
  15.     public function __construct(EventDispatcherInterface $eventDispatcher)
  16.     {
  17.         $this->eventDispatcher $eventDispatcher;
  18.     }
  19.     public static function getSubscribedEvents()
  20.     {
  21.         return [
  22.             ProductCrossSellingIdsCriteriaEvent::class => 'crossSellingIdEvent',
  23.             ProductCrossSellingStreamCriteriaEvent::class => 'crossSellingStreamEvent',
  24.         ];
  25.     }
  26.     /**
  27.      * @deprecated tag:v6.4.0 - CrossSellingProductListCriteriaEvent event will be removed
  28.      */
  29.     public function crossSellingIdEvent(ProductCrossSellingIdsCriteriaEvent $event): void
  30.     {
  31.         $this->eventDispatcher->dispatch(
  32.             new CrossSellingProductListCriteriaEvent($event->getCrossSelling(), $event->getCriteria(), $event->getSalesChannelContext())
  33.         );
  34.     }
  35.     /**
  36.      * @deprecated tag:v6.4.0 - CrossSellingProductStreamCriteriaEvent event will be removed
  37.      */
  38.     public function crossSellingStreamEvent(ProductCrossSellingStreamCriteriaEvent $event): void
  39.     {
  40.         $this->eventDispatcher->dispatch(
  41.             new CrossSellingProductStreamCriteriaEvent($event->getCrossSelling(), $event->getCriteria(), $event->getSalesChannelContext())
  42.         );
  43.     }
  44. }