custom/static-plugins/CioApprovalThreshold/src/Subscriber/BusinessEventCollectorSubscriber.php line 28

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