custom/plugins/InxmailApiCall/src/Subscriber/RegisterSubscriber.php line 24

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace InxmailApiCall\Subscriber;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
  4. use Shopware\Core\Content\Newsletter\Event\NewsletterRegisterEvent;
  5. use Shopware\Core\Content\Newsletter\Event\NewsletterConfirmEvent;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. use Shopware\Core\Content\Product\ProductEvents;
  8. use Shopware\Core\Content\Newsletter\NewsletterEvents;
  9. class RegisterSubscriber implements EventSubscriberInterface
  10. {
  11.     public static function getSubscribedEvents(): array
  12.     {
  13.         // Return the events to listen to as array like this:  <event to listen to> => <method to execute>
  14.         return [
  15.             NewsletterEvents::NEWSLETTER_REGISTER_EVENT => 'onNewsletterConfirmed'
  16.         ];
  17.     }
  18.     public function onNewsletterConfirmed(NewsletterRegisterEvent $event)
  19.     {
  20.         // Do something
  21.         // E.g. work with the loaded entities: $event->getEntities()
  22.         //$test = $event->getAvailableData();
  23.         //print_r(json_decode('test123'));
  24.     }
  25. }