src/Security/InterventionVoter.php line 10
<?phpnamespace App\Security;use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;use Symfony\Component\Security\Core\Authorization\Voter\Voter;use App\Entity\User;use App\Entity\Intervention;class InterventionVoter extends Voter{const CAN_EDIT = 'iv_canedit';/*** @param string $attribute* @param Intervention $subject* @param TokenInterface $token* @return bool*/protected function voteOnAttribute($attribute, $subject, TokenInterface $token) : bool{$user = $token->getUser();if (!$user instanceof User) {return false;}if ($attribute === self::CAN_EDIT) {return $user === $subject->getUser();}return false;}/*** @param string $attribute* @param Intervention $subject* @return bool*/protected function supports($attribute, $subject) : bool{if (!in_array($attribute, [self::CAN_EDIT])) {return false;}if (!$subject instanceof Intervention) {return false;}return true;}}