/** * 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; }