| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- declare(strict_types=1);
- namespace Meramo\Begriffmgt\Controller;
- use Meramo\Begriffmgt\Domain\Repository\TypeRepository;
- use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
- use Meramo\Begriffmgt\Domain\Repository\TermRepository;
- use Meramo\Begriffmgt\Domain\Repository\CategoryRepository;
- class DashboardController extends ActionController
- {
- protected $termRepository;
- protected $termController;
- protected $categoryRepository;
- protected $categoryController;
- protected $typeRepository;
- protected $typeController;
- public function __construct(
- TermRepository $termRepository,
- CategoryRepository $categoryRepository,
- CategoryController $categoryController,
- TypeRepository $typeRepository,
- TypeController $typeController,
- TermController $termController
- ) {
- $this->termRepository = $termRepository;
- $this->categoryRepository = $categoryRepository;
- $this->categoryController = $categoryController;
- $this->termController = $termController;
- $this->typeRepository = $typeRepository;
- $this->typeController = $typeController;
- }
- public function indexAction(): void
- {
- $terms = $this->termRepository->findAll();
- $categories = $this->categoryRepository->findAll();
- $this->view->assignMultiple([
- 'terms' => $terms,
- 'categories' => $categories,
- ]);
- }
- public function newAction(): void {
- }
- public function listAction(): void {
- $terms = $this->termRepository->findAll();
- $this->view->assign('terms', $terms);
- }
- public function createAction(string $termList, string $categoryTitle, string $typeTitle): void {
- $terms = array_map('trim', explode(',', $termList));
- $category = $this->categoryController->createAction($categoryTitle);
- $categoryObj = $this->categoryRepository->findByUid($category);
- $type = $this->typeController->createAction($typeTitle);
- $typeObj = $this->typeRepository->findByUid($type);
- $this->termController->createAction($terms, $categoryObj, $typeObj);
- $this->redirect('index');
- }
- }
|