<?php
declare(strict_types=1);
namespace NetInventors\NetiNextExportOnEvent\Subscriber;
use NetInventors\NetiNextExportOnEvent\Services\Event\ExportOnEventAware;
use Shopware\Core\Framework\Event\BusinessEventCollectorEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class BusinessEventCollectorSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
BusinessEventCollectorEvent::NAME => 'addExportOnEventAware',
];
}
public function addExportOnEventAware(BusinessEventCollectorEvent $event): void
{
foreach ($event->getCollection()->getElements() as $definition) {
$definition->addAware(ExportOnEventAware::class);
}
}
}