custom/plugins/MoorlCustomerAccounts/src/Subscriber/BusinessEventCollectorSubscriber.php line 27

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace MoorlCustomerAccounts\Subscriber;
  3. use MoorlCustomerAccounts\Core\Event\InitialPasswordEvent;
  4. use Shopware\Core\Framework\Event\BusinessEventCollector;
  5. use Shopware\Core\Framework\Event\BusinessEventCollectorEvent;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class BusinessEventCollectorSubscriber implements EventSubscriberInterface
  8. {
  9.     private BusinessEventCollector $businessEventCollector;
  10.     public function __construct(
  11.         BusinessEventCollector $businessEventCollector
  12.     ) {
  13.         $this->businessEventCollector $businessEventCollector;
  14.     }
  15.     public static function getSubscribedEvents(): array
  16.     {
  17.         return [
  18.             BusinessEventCollectorEvent::NAME => 'onBusinessEventCollectorEvent',
  19.         ];
  20.     }
  21.     public function onBusinessEventCollectorEvent(BusinessEventCollectorEvent $event): void
  22.     {
  23.         $collection $event->getCollection();
  24.         $collection->add($this->businessEventCollector->define(InitialPasswordEvent::class));
  25.     }
  26. }