Exemplo n.º 1
0
 /**
  * Mainly included for test purposes.
  *
  * @param \_OurBrand_\Quiz\Domain\Model\StudentQuizSession $studentQuizSession
  * @param bool $force
  *
  * @throws \Exception
  */
 public function destroyStudentQuizSessionAction($studentQuizSession, $force = false)
 {
     if ($studentQuizSession->getStartTime() && !$force) {
         // TODO: Correct exception.
         throw new \Exception('Can not delete session which has been started');
     }
     $answers = $this->answerRepository->findBySession($studentQuizSession);
     foreach ($answers as $answer) {
         $this->answerRepository->remove($answer);
     }
     $trackers = $this->trackStudentAudioPlaybackRepository->findByStudentQuizSession($studentQuizSession);
     foreach ($trackers as $tracker) {
         $this->trackStudentAudioPlaybackRepository->remove($tracker);
     }
     $this->studentQuizSessionRepository->remove($studentQuizSession);
     $this->redirect('index');
 }