Skip to content
Snippets Groups Projects
Commit 342f5fac authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Dont return news when no category ids are found

parent 7430846f
No related branches found
No related tags found
1 merge request!2Feature be module
......@@ -88,6 +88,6 @@ class BackendController extends ActionController {
$this->view->assign('pageUid', $pageUid);
$this->view->assign('categories', $categories);
$this->view->assign('news', $news);
$this->view->assign('fitlers', $filters);
$this->view->assign('filters', $filters);
}
}
......@@ -140,6 +140,15 @@ class Utility {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var NewsRepository $newsRepository */
$newsRepository = $objectManager->get(NewsRepository::class);
return $newsRepository->findAllSortedNewsByCategories(array_keys($categories), 0, 0, 'date', NULL, $raw = TRUE);
$categoryIds = [];
foreach($categories as $key => $value) {
$categoryIds[] = $key;
}
if (empty($categoryIds)) {
return [];
}
return $newsRepository->findAllSortedNewsByCategories($categoryIds, 0, 0, 'date', NULL, $raw = TRUE);
}
}
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