/**
  * @param string $session
  */
 public function deleteAction($session)
 {
     $account = $this->securityContext->getAccount();
     /** @var \T3DD\Backend\Domain\Model\Vote $vote */
     $vote = $this->voteRepository->getVoteForAccountAndSession($session, $account);
     if (!$vote) {
         $this->response->setStatus(404);
         return;
     }
     $this->voteRepository->remove($vote);
 }
 /**
  * @param Session $session
  */
 public function deleteAction(Session $session)
 {
     if ($session->getAccount() !== $this->securityContext->getAccount() && !$this->securityContext->hasRole('T3DD.Backend:Administrator')) {
         $this->response->setStatus(403);
         return;
     }
     foreach ($this->voteRepository->findBySession($session) as $vote) {
         $this->voteRepository->remove($vote);
     }
     $this->sessionRepository->remove($session);
     // TODO Fix redirect
     $this->redirect('index');
 }
 /**
  * @param \T3DD\Backend\Domain\Model\Session $session
  * @return void
  */
 protected function isValid($session)
 {
     if ($this->voteRepository->hasUserVotedForSession($session, $this->securityContext->getAccount())) {
         $this->addError('You have already voted for that session', 1424114090);
     }
 }