Browse Source

add simple controller which uses the methods of dashboard controller and the repositories of begriffmgt extension

ksieren 2 years ago
parent
commit
a40f33de5a
2 changed files with 36 additions and 0 deletions
  1. 0 0
      Classes/.gitkeep
  2. 36 0
      Classes/Controller/SimpleController.php

+ 0 - 0
Classes/.gitkeep


+ 36 - 0
Classes/Controller/SimpleController.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace Meramo\Speedbase\Controller;
+
+use Meramo\Begriffmgt\Controller\DashboardController;
+use Meramo\Begriffmgt\Domain\Repository\CategoryRepository;
+use Meramo\Begriffmgt\Domain\Repository\TypeRepository;
+use Meramo\Begriffmgt\Domain\Repository\UrlRepository;
+use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
+
+class SimpleController extends ActionController
+{
+    public function __construct(
+        DashboardController $dashboardController,
+        CategoryRepository $categoryRepository,
+        TypeRepository $typeRepository,
+        UrlRepository $urlRepository
+    ){
+        $this->dashboardController = $dashboardController;
+        $this->categoryRepository = $categoryRepository;
+        $this->typeRepository = $typeRepository;
+        $this->urlRepository = $urlRepository;
+    }
+    public function persistDataToDBAction($termsList, $category, $type, $url){
+        if(!($category === '')){
+            $category = ($this->categoryRepository->findByUid($category))->getTitle();
+        }
+        if(!($type === '')){
+            $type = ($this->typeRepository->findByUid($type))->getTitle();
+        }
+        if(!($url === '')){
+            $url = ($this->urlRepository->findByUid($url))->getTitle();
+        }
+        $this->dashboardController->createAction($termsList, $category, $type, $url);
+    }
+}