accessDecisionManager = $accessDecisionManager; } protected function supports($attribute, $subject) { return $subject instanceof Resource && self::EDIT === $attribute; } protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { /** @var \Chill\PersonBundle\Entity\AccompanyingPeriod\Resource $subject */ switch ($attribute) { case self::EDIT: return $this->accessDecisionManager->decide( $token, [AccompanyingPeriodVoter::EDIT], $subject->getAccompanyingPeriod() ); default: throw new UnexpectedValueException("attribute not supported: {$attribute}"); } } }