SimpleController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Meramo\Speedbase\Controller;
  3. use Meramo\Begriffmgt\Controller\DashboardController;
  4. use Meramo\Begriffmgt\Domain\Repository\CategoryRepository;
  5. use Meramo\Begriffmgt\Domain\Repository\TypeRepository;
  6. use Meramo\Begriffmgt\Controller\UrlController;
  7. use Meramo\Begriffmgt\Domain\Repository\UrlRepository;
  8. use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
  9. class SimpleController extends ActionController
  10. {
  11. public function __construct(
  12. DashboardController $dashboardController,
  13. CategoryRepository $categoryRepository,
  14. TypeRepository $typeRepository,
  15. UrlRepository $urlRepository,
  16. UrlController $urlController
  17. ){
  18. $this->dashboardController = $dashboardController;
  19. $this->categoryRepository = $categoryRepository;
  20. $this->typeRepository = $typeRepository;
  21. $this->urlRepository = $urlRepository;
  22. $this->urlController = $urlController;
  23. }
  24. public function persistDataToDBAction($termsList, $category, $type, $url){
  25. if(!($category === '') && !($category === null)){
  26. $category = ($this->categoryRepository->findByUid($category))->getTitle();
  27. }
  28. if(!($type === '') && !($type === null)){
  29. $type = ($this->typeRepository->findByUid($type))->getTitle();
  30. }
  31. if($url === null){
  32. $url = '';
  33. }
  34. $this->dashboardController->createAction($termsList, $category, $type, $url);
  35. }
  36. }