Skip to content
Snippets Groups Projects

[BUGFIX] Fix NewsByAuthors crashing when multiple authors are given

Merged Michael Kessler requested to merge bugfix_NewsByAuthor into master
2 files
+ 35
17
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -79,25 +79,28 @@ class NewsByAuthorController extends AbstractController {
$categories = $newsMetaData = [];
$categoryRepository = $this->objectManager->get(CategoryRepository::class);
$excludedNewsIds = GeneralUtility::intExplode(',', $this->settings['excludedNews']);
foreach ($news as $newsEntry) {
/** @var News $newsEntry */
if (in_array($newsEntry->getUid(), $excludedNewsIds, TRUE)) {
continue;
}
$categoryId = $newsEntry->getPid();
if (!isset($categories[$categoryId])) {
$category = $categoryRepository->findByUid($categoryId);
if (!$category) {
foreach ($news as $newsResult) {
foreach ($newsResult as $newsEntry) {
/** @var News $newsEntry */
if (in_array($newsEntry->getUid(), $excludedNewsIds, TRUE)) {
continue;
}
$categories[$categoryId] = $category;
}
$categoryId = $newsEntry->getPid();
if (!isset($categories[$categoryId])) {
$category = $categoryRepository->findByUid($categoryId);
if (!$category) {
continue;
}
$newsMetaData[] = $this->getMetaDataForNews($newsEntry, $categories[$categoryId]);
$categories[$categoryId] = $category;
}
$newsMetaData[] = $this->getMetaDataForNews($newsEntry, $categories[$categoryId]);
}
}
$this->view->assign('newsMetaData', $newsMetaData);
$this->view->assign('authors', $authors);
}
Loading