termRepository = $termRepository; $this->categoryRepository = $categoryRepository; $this->categoryController = $categoryController; $this->termController = $termController; $this->typeRepository = $typeRepository; $this->typeController = $typeController; $this->urlRepository = $urlRepository; $this->urlController = $urlController; } public function indexAction(): void { $terms = $this->termRepository->findAllOrderedByTerm(); $categories = $this->categoryRepository->findAllOrderedByTitle(); $types = $this->typeRepository->findAllOrderedByTitle(); $urls = $this->urlRepository->findAllOrderedByTitle(); $this->view->assignMultiple([ 'terms' => $terms, 'categories' => $categories, 'types' => $types, 'urls' => $urls ]); } public function newAction(): void { } public function listAction(): void { $terms = $this->termRepository->findAll(); $this->view->assign('terms', $terms); } public function createAction(string $termList, $categoryTitle, $typeTitle, string $urlTitle): void { $terms = array_map('trim', explode(';', $termList)); if($categoryTitle){ $category = $this->categoryController->createAction($categoryTitle); $categoryObj = $this->categoryRepository->findByUid($category); } if($typeTitle){ $type = $this->typeController->createAction($typeTitle); $typeObj = $this->typeRepository->findByUid($type); } $url = $this->urlController->createAction($urlTitle); $urlObj = $this->urlRepository->findByUid($url); $this->termController->createAction($terms, $categoryObj, $typeObj, $urlObj); $request = $this->request; if ($request) { // Called by a form action - in this case the data is persisted to the db 'automatically' $this->redirect('index'); } else { // Called by another controller $persistenceManager = $this->objectManager->get(PersistenceManager::class); $persistenceManager->persistAll(); } } public function deleteTermAction(int $termId): void { $this->termController->deleteAction($termId); $this->redirect('index'); } }