custom/plugins/CioImports/src/Subscriber/CustomBusinessEventsSubscriber.php line 22

Open in your IDE?
  1. <?php
  2. namespace CioImports\Subscriber;
  3. use CioImports\Event\ImportStockMissingProductNotificationEvent;
  4. use Shopware\Core\Framework\Event\BusinessEventCollectorEvent;
  5. use Shopware\Core\Framework\Event\BusinessEventDefinition;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. class CustomBusinessEventsSubscriber implements EventSubscriberInterface
  8. {
  9.     public static function getSubscribedEvents()
  10.     {
  11.         // Return the events to listen to as array like this:  <event to listen to> => <method to execute>
  12.         return [
  13.             'collect.business-events' => 'onBusinessEvent'
  14.         ];
  15.     }
  16.     public function onBusinessEvent(BusinessEventCollectorEvent $event) {
  17.         $event->getCollection()->add(new BusinessEventDefinition(
  18.             'import.notification.stock.missing',
  19.             ImportStockMissingProductNotificationEvent::class,
  20.             true,
  21.             false,
  22.             false,
  23.             []
  24.         ));
  25.     }
  26. }