src/Contact/EventSubscriber/SetInitialAccessTrackingSubscriber.php line 43
<?phpdeclare(strict_types=1);/*** Copyright (c) 2022 TECLA Consulting Group oü.* All rights reserved.** This unpublished material is proprietary to TECLA Consulting Group oü.* All rights reserved. The methods and* techniques described herein are considered trade secrets* and/or confidential. Reproduction or distribution, in whole* or in part, is forbidden except by express written permission* of TECLA Consulting Group oü.** @author Matúš Sýkorjak <matus@tecla.no>* @copyright 2022 TECLA Consulting Group oü*/namespace App\Contact\EventSubscriber;use App\Contact\Event\ContactAccess\CreatedEvent;use App\Contact\Service\ContactAccessTrackingServiceInterface;use JetBrains\PhpStorm\ArrayShape;use Symfony\Component\EventDispatcher\EventSubscriberInterface;final class SetInitialAccessTrackingSubscriber implements EventSubscriberInterface{private ContactAccessTrackingServiceInterface $accessTrackingService;public function __construct(ContactAccessTrackingServiceInterface $accessTrackingService){$this->accessTrackingService = $accessTrackingService;}#[ArrayShape([CreatedEvent::class => 'string'])]public static function getSubscribedEvents(): array{return [CreatedEvent::class => 'onContactAccessCreated',];}public function onContactAccessCreated(CreatedEvent $event): void{$access = $event->getContactAccess();$this->accessTrackingService->track($access->getContact(), $access->getAccessor());}}