src/Event/AccountEventToContactsSubscriber.php line 27

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Event;
  4. use App\Event\AccountEventToContactsEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use App\Services\ContactEvent\ContactEventService;
  7. class AccountEventToContactsSubscriber implements EventSubscriberInterface
  8. {
  9.     protected ContactEventService $contactEventService;
  10.     public function __construct(ContactEventService $contactEventService)
  11.     {
  12.         $this->contactEventService $contactEventService;
  13.     }
  14.     public static function getSubscribedEvents()
  15.     {
  16.         return [
  17.             AccountEventToContactsEvent::NAME => 'onAccountEvent',
  18.         ];
  19.     }
  20.     public function onAccountEvent(AccountEventToContactsEvent $event): void
  21.     {
  22.         $this->contactEventService->copyAccountEventItemToContact(
  23.             $event->getEventAccount(),
  24.             $event->getContactIds()
  25.         );
  26.     }
  27. }