diff --git a/Classes/Domain/Repository/TimelineEventRepository.php b/Classes/Domain/Repository/TimelineEventRepository.php index 99b2c03..db51173 100644 --- a/Classes/Domain/Repository/TimelineEventRepository.php +++ b/Classes/Domain/Repository/TimelineEventRepository.php @@ -2,14 +2,31 @@ namespace DominicJoas\Timeline\Domain\Repository; +use TYPO3\CMS\Extbase\Persistence\Generic\Query; use TYPO3\CMS\Extbase\Persistence\Repository; class TimelineEventRepository extends Repository { + /** + * @param int $uid + * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface + */ public function getContentElementEntries($uid) { + /** @var \TYPO3\CMS\Extbase\Persistence\Generic\Query */ $query = $this->createQuery(); - $query->statement("SELECT * FROM tx_timeline_domain_model_timelineevent WHERE timetable_id=$uid ORDER BY start_date"); + + $query->getQuerySettings()->setRespectStoragePage(false); + + $query->matching( + $query->equals('timetable_id', (int)$uid) + ); + $query->setOrderings([ + 'start_date' => Query::ORDER_ASCENDING, + ]); + + /** @var \TYPO3\CMS\Extbase\Persistence\QueryResultInterface */ $result = $query->execute(); + return $result; } }