<?php declare(strict_types=1);
namespace InxmailApiCall\Subscriber;
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
use Shopware\Core\Content\Newsletter\Event\NewsletterRegisterEvent;
use Shopware\Core\Content\Newsletter\Event\NewsletterConfirmEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Shopware\Core\Content\Product\ProductEvents;
use Shopware\Core\Content\Newsletter\NewsletterEvents;
class RegisterSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
// Return the events to listen to as array like this: <event to listen to> => <method to execute>
return [
NewsletterEvents::NEWSLETTER_REGISTER_EVENT => 'onNewsletterConfirmed'
];
}
public function onNewsletterConfirmed(NewsletterRegisterEvent $event)
{
// Do something
// E.g. work with the loaded entities: $event->getEntities()
//$test = $event->getAvailableData();
//print_r(json_decode('test123'));
}
}