问题描述
由于我需要某些自定义功能,因此我将覆盖NewsController.php的listAction。
我创建了$ demand onject,其中包含所有新闻。 我的目标是在$ demand对象中仅包含topNews。
我尝试了以下操作:
$demand->getTopNewsRestriction(1);
$topNews = $this->newsRepository->findDemanded($demand);
结果,我仍然可以获得所有新闻,也包括非topNews。有人可以帮忙吗? 我正在使用TYPO3 v10。
解决方法
$ demand-> setTopNewsRestriction(1);会成功的