<?php declare(strict_types=1);
namespace ProclaneWegmannThemeExtend\Decorator\Core\Flow;
use Shopware\Core\Framework\Event\BusinessEventCollector;
use Shopware\Core\Framework\Event\BusinessEventCollectorEvent;
use Shopware\Core\Framework\Log\Package;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use ProclaneWegmannThemeExtend\Decorator\Core\Checkout\Customer\SalesChannel\CustomerAccountRecoverRequestFrontendEvent;
use Shopware\Core\Framework\Event\BusinessEventDefinition;
/**
* @internal
*/
#[Package('checkout')]
class BusinessEventCollectorSubscriber implements EventSubscriberInterface
{
public function __construct(private readonly BusinessEventCollector $businessEventCollector)
{
}
/**
* @return array<string, string|array{0: string, 1: int}|list<array{0: string, 1?: int}>>
*/
public static function getSubscribedEvents(): array
{
return [
BusinessEventCollectorEvent::NAME => ['onAddEvent', 1000],
];
}
public function onAddEvent(BusinessEventCollectorEvent $event): void
{
$collection = $event->getCollection();
$definition = $this->businessEventCollector->define(CustomerAccountRecoverRequestFrontendEvent::class);
if (!$definition) {
return;
}
$collection->set($definition->getName(), $definition);
}
}