Skip to content
Snippets Groups Projects
Commit 8fa2bb6e authored by Matthias Adrowski's avatar Matthias Adrowski
Browse files

[TASK] Migrate NewsByAuthorController

parent 57f1773e
No related branches found
No related tags found
1 merge request!38Feature upgrade to typo3 11
......@@ -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();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment