custom/plugins/WabsProductPreorder/src/Subscriber/BusinessEventCollectorSubscriber.php line 25

Open in your IDE?
  1. <?php
  2. namespace Wabs\ProductPreorder\Subscriber;
  3. use Shopware\Core\Framework\Event\BusinessEventCollector;
  4. use Shopware\Core\Framework\Event\BusinessEventCollectorEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Wabs\ProductPreorder\Core\Checkout\Order\Event\PreorderPriceAdjustedEvent;
  7. class BusinessEventCollectorSubscriber implements EventSubscriberInterface
  8. {
  9.     private BusinessEventCollector $businessEventCollector;
  10.     public function __construct(BusinessEventCollector $businessEventCollector) {
  11.         $this->businessEventCollector $businessEventCollector;
  12.     }
  13.     public static function getSubscribedEvents()
  14.     {
  15.         return [
  16.             BusinessEventCollectorEvent::NAME => ['onAddExampleEvent'1000],
  17.         ];
  18.     }
  19.     public function onAddExampleEvent(BusinessEventCollectorEvent $event): void
  20.     {
  21.         $collection $event->getCollection();
  22.         $definition $this->businessEventCollector->define(PreorderPriceAdjustedEvent::class);
  23.         if (!$definition) {
  24.             return;
  25.         }
  26.         $collection->set($definition->getName(), $definition);
  27.     }
  28. }