コード例 #1
0
 /**
  * @param \_OurBrand_\Quiz\Domain\Model\Quiz $quiz
  * @Flow\IgnoreValidation("$quiz")
  * @throws \Exception
  */
 public function destroyAction($quiz)
 {
     // Several things we need to check for. If the quiz has been assigned to
     // student we may have a problem. (we do)
     $sessions = $this->studentQuizSessionRepository->findByQuiz($quiz);
     if ($sessions->count() > 0) {
         throw new \Exception('Can not delete quiz that has been assigned');
     }
     $this->quizRepository->remove($quiz);
     $this->redirect('index');
 }
コード例 #2
0
 /**
  * @param string $authentication
  * @param string $quizIdentifier
  */
 public function quizDeleteAction($authentication, $quizIdentifier)
 {
     if (!$this->verifyAuthentication($authentication, (string) $quizIdentifier)) {
         throw new AccessDeniedException('Access denied');
     }
     $quiz = $this->quizRepository->findByIdentifier($quizIdentifier);
     if ($quiz) {
         $this->quizRepository->remove($quiz);
         $this->persistenceManager->persistAll();
     }
     $this->view->assign('value', array('ok'));
 }