/** * Assigns the Security token's user to the vote. * * @throws InvalidArgumentException when the vote does not implement SignedVoteInterface * @throws RuntimeException When the firewall is not properly configured * @param VoteInterface $vote * @return void */ public function blame(VoteInterface $vote) { if (!$vote instanceof SignedVoteInterface) { throw new InvalidArgumentException('The vote must implement SignedVoteInterface'); } if (null === $this->securityContext->getToken()) { throw new RuntimeException('You must configure a firewall for this route'); } if ($this->securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) { $vote->setVoter($this->securityContext->getToken()->getUser()); } }