custom/plugins/MadCreateBuisnessMail/src/Core/Subscriber/BusinessEventCollectorSubscriber.php line 31

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