<?php
namespace CioImports\Subscriber;
use CioImports\Event\ImportStockMissingProductNotificationEvent;
use Shopware\Core\Framework\Event\BusinessEventCollectorEvent;
use Shopware\Core\Framework\Event\BusinessEventDefinition;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class CustomBusinessEventsSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents()
{
// Return the events to listen to as array like this: <event to listen to> => <method to execute>
return [
'collect.business-events' => 'onBusinessEvent'
];
}
public function onBusinessEvent(BusinessEventCollectorEvent $event) {
$event->getCollection()->add(new BusinessEventDefinition(
'import.notification.stock.missing',
ImportStockMissingProductNotificationEvent::class,
true,
false,
false,
[]
));
}
}