/** * Get Category options * * @param $subjects * @param $type * @return array */ protected function getQuizCategoryOptions($subjects, $type) { $options = array(); $quizCategories = $this->quizCategoryRepository->findBySubjectsAndProductAndParentCategory($subjects, $type, null); foreach ($quizCategories as $quizCategory) { $categoryId = $this->persistenceManager->getIdentifierByObject($quizCategory); $options[$categoryId] = $quizCategory->getValue(); $subs = $quizCategory->getSubCategories(); if (is_object($subs) && count($subs)) { foreach ($subs as $sub) { $subCategoryId = $this->persistenceManager->getIdentifierByObject($sub); $options[$subCategoryId] = $quizCategory->getValue() . ' - ' . $sub->getValue(); } } } return $options; }
/** * @param \_OurBrand_\Quiz\Domain\Model\QuizCategory $quizCategory */ public function removeQuizCategoryAction(\_OurBrand_\Quiz\Domain\Model\QuizCategory $quizCategory) { $this->quizCategoryRepository->remove($quizCategory); $this->persistenceManager->persistAll(); $this->redirect('newQuizCategory'); }