<?php
declare(strict_types=1);
namespace App\Event;
use App\Event\ContactLockStatusEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use App\Services\Contact\ContactService;
class ContactLockStatusSubscriber implements EventSubscriberInterface
{
protected ContactService $contactService;
public function __construct(ContactService $contactService)
{
$this->contactService = $contactService;
}
public static function getSubscribedEvents()
{
return [
ContactLockStatusEvent::NAME => 'onContactLock',
];
}
public function onContactLock(ContactLockStatusEvent $event): void
{
$this->contactService->setContactLockStatus(
$event->getContact(),
$event->getLockStatus(),
$event->getForceUnlock()
);
}
}