src/Event/ContactLockStatusSubscriber.php line 27

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Event;
  4. use App\Event\ContactLockStatusEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use App\Services\Contact\ContactService;
  7. class ContactLockStatusSubscriber implements EventSubscriberInterface
  8. {
  9.     protected ContactService $contactService;
  10.     public function __construct(ContactService $contactService)
  11.     {
  12.         $this->contactService $contactService;
  13.     }
  14.     public static function getSubscribedEvents()
  15.     {
  16.         return [
  17.             ContactLockStatusEvent::NAME => 'onContactLock',
  18.         ];
  19.     }
  20.     public function onContactLock(ContactLockStatusEvent $event): void
  21.     {
  22.         $this->contactService->setContactLockStatus(
  23.             $event->getContact(),
  24.             $event->getLockStatus(),
  25.             $event->getForceUnlock()
  26.         );
  27.     }
  28. }