From 8fa2bb6e515694bed6dde3f4926ed4ab22a8d4cd Mon Sep 17 00:00:00 2001 From: Matthias Adrowski <matthias.adrowski@sgalinski.de> Date: Mon, 10 Jan 2022 15:45:36 +0100 Subject: [PATCH] [TASK] Migrate NewsByAuthorController --- Classes/Controller/NewsByAuthorController.php | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/Classes/Controller/NewsByAuthorController.php b/Classes/Controller/NewsByAuthorController.php index 4ace64d..9706632 100644 --- a/Classes/Controller/NewsByAuthorController.php +++ b/Classes/Controller/NewsByAuthorController.php @@ -49,13 +49,18 @@ class NewsByAuthorController extends AbstractController { * @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException * @throws \TYPO3\CMS\Core\Package\Exception */ - public function listAction($authorId = 0): void { + public function listAction($authorId = 0): ?\Psr\Http\Message\ResponseInterface { if ($authorId) { $newsAuthorsIds[] = $authorId; } else { $newsAuthorsIds = GeneralUtility::intExplode(',', $this->settings['newsAuthors']); if (\count($newsAuthorsIds) <= 0) { - return; + if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { + return NULL; + } + else { + return $this->htmlResponse(); + } } } @@ -88,13 +93,23 @@ class NewsByAuthorController extends AbstractController { } if (\count($authors) <= 0) { - return; + if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { + return NULL; + } + else { + return $this->htmlResponse(); + } } $newsRepository = $this->objectManager->get(NewsRepository::class); $news = $newsRepository->findAllByNewsAuthor($newsAuthorsIds); if (\count($news) <= 0) { - return; + if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { + return NULL; + } + else { + return $this->htmlResponse(); + } } $categories = $newsMetaData = []; @@ -124,5 +139,12 @@ class NewsByAuthorController extends AbstractController { $this->view->assign('newsMetaData', $newsMetaData); $this->view->assign('authors', $authors); + + if (version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '11.0.0', '<')) { + return NULL; + } + else { + return $this->htmlResponse(); + } } } -- GitLab