custom/plugins/b2bsellerscore/addons/B2bOffer/Subscriber/BusinessEventCollectorSubscriber.php line 31

Open in your IDE?
  1. <?php
  2. namespace B2bOffer\Subscriber;
  3. use B2bOffer\Components\LineItemEdit\Events\LineItemEditedEvent;
  4. use B2bOffer\Components\Offer\Events\OfferOrderedByCustomerEvent;
  5. use B2bOffer\Components\Offer\Events\OfferRequestCreatedEvent;
  6. use B2bOffer\Components\Offer\Events\OfferStatusUpdatedEvent;
  7. use B2bOffer\Components\Offer\Events\OfferValidityExtensionRequestedEvent;
  8. use B2bOffer\Components\Offer\Events\PdfOfferCreatedEvent;
  9. use Shopware\Core\Framework\Event\BusinessEventCollector;
  10. use Shopware\Core\Framework\Event\BusinessEventCollectorEvent;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. class BusinessEventCollectorSubscriber implements EventSubscriberInterface
  13. {
  14.     private BusinessEventCollector $businessEventCollector;
  15.     public function __construct(BusinessEventCollector $businessEventCollector)
  16.     {
  17.         $this->businessEventCollector $businessEventCollector;
  18.     }
  19.     public static function getSubscribedEvents(): array
  20.     {
  21.         return [
  22.             BusinessEventCollectorEvent::NAME => ['onAddB2bOfferBusinessEvents'1000],
  23.         ];
  24.     }
  25.     public function onAddB2bOfferBusinessEvents(BusinessEventCollectorEvent $event): void
  26.     {
  27.         $collection $event->getCollection();
  28.         $definition $this->businessEventCollector->define(PdfOfferCreatedEvent::class, PdfOfferCreatedEvent::EVENT_NAME);
  29.         $collection->set(PdfOfferCreatedEvent::EVENT_NAME$definition);
  30.         $definition $this->businessEventCollector->define(LineItemEditedEvent::class, LineItemEditedEvent::EVENT_NAME);
  31.         $collection->set(LineItemEditedEvent::EVENT_NAME$definition);
  32.         $definition $this->businessEventCollector->define(OfferRequestCreatedEvent::class, OfferRequestCreatedEvent::EVENT_NAME);
  33.         $collection->set(OfferRequestCreatedEvent::EVENT_NAME$definition);
  34.         $definition $this->businessEventCollector->define(OfferValidityExtensionRequestedEvent::class, OfferValidityExtensionRequestedEvent::EVENT_NAME);
  35.         $collection->set(OfferValidityExtensionRequestedEvent::EVENT_NAME$definition);
  36.         $definition $this->businessEventCollector->define(OfferStatusUpdatedEvent::class, OfferStatusUpdatedEvent::EVENT_NAME);
  37.         $collection->set(OfferStatusUpdatedEvent::EVENT_NAME$definition);
  38.         $definition $this->businessEventCollector->define(OfferOrderedByCustomerEvent::class, OfferOrderedByCustomerEvent::EVENT_NAME);
  39.         $collection->set(OfferOrderedByCustomerEvent::EVENT_NAME$definition);
  40.     }
  41. }