/** * @param \_OurBrand_\Quiz\Domain\Model\Quiz $quiz * */ public function createAction($quiz = null) { if (!$quiz) { $quiz = new \_OurBrand_\Quiz\Domain\Model\Quiz(); } if ($this->request->hasArgument('quiztype')) { $quiz->setType((int) $this->request->getArgument('quiztype')); } if (!$this->accessHelper->canUserCreateQuiz($this->currentUser, $quiz->getType())) { $this->throwStatus(403); } $quiz->setCreator($this->currentUser->getIdentifier()); $quiz->setAuthor($this->currentUser->getName()); $quiz->setQuiz($this->currentUser->isworker()); $this->quizRepository->add($quiz); $this->persistenceManager->persistAll(); $this->redirect('edit', 'quiz', null, array('quiz' => $quiz)); }