handlers as $handler) { if ($handler->isObjectSupported($subject) && \in_array($attribute, $handler->getDeletionRoles(), true)) { return true; } } return false; } protected function voteOnAttribute($attribute, $subject, TokenInterface $token) { foreach ($this->handlers as $handler) { if ($handler->isObjectSupported($subject)) { return 0 === $this->entityWorkflowRepository->countRelatedWorkflows( $handler->getRelatedObjects($subject) ); } } throw new \RuntimeException('no handlers found'); } }