src/Note/EventSubscriber/RevokePermissionSubscriber.php line 47
<?phpdeclare(strict_types=1);/*** Copyright (c) 2023 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 2023 TECLA Consulting Group oü*/namespace App\Note\EventSubscriber;use App\Note\Event\Note\DeleteEvent;use App\Note\Query\NotePermission\FindAllByNoteQueryInterface;use App\Note\Service\NotePermissionServiceInterface;use Symfony\Component\EventDispatcher\EventSubscriberInterface;final class RevokePermissionSubscriber implements EventSubscriberInterface{private FindAllByNoteQueryInterface $findAllQuery;private NotePermissionServiceInterface $notePermissionService;public function __construct(FindAllByNoteQueryInterface $findAllQuery,NotePermissionServiceInterface $notePermissionService) {$this->findAllQuery = $findAllQuery;$this->notePermissionService = $notePermissionService;}public static function getSubscribedEvents(): array{return [DeleteEvent::class => 'onDeleteEvent',];}public function onDeleteEvent(DeleteEvent $event): void{$permissions = $this->findAllQuery->execute($event->getNote());$this->notePermissionService->deleteCollection($permissions);}}