[TYPO3-mvc] Individual Database Queries

Bernhard Schenkenfelder bernhard at schenkenfelder.co.at
Wed Sep 24 11:51:23 CEST 2014


My simple trip manager extension comprises of the following two classes:

Trip
- destination
- image
- dates (1:n relation)

Date
- dateFrom
- dateTo
- price

Since a trip may take place on several dates, there is a 1:n relation dates from Trip to Date. For obvious reasons, only future trips should be surfaced, which the following snippet basically does:

$query->matching($query->greaterThanOrEqual('dates.date_from', $dateTime->format('Y-m-d')));

However, if I var_dump() the result (or access it via trip.dates in Fluid), the dates property also contains trips from the past.

Any ideas how to get rid of those? A JOIN in native SQL would of course get rid all rows with past dates. How does the TYPO3 persistence layer handle this issue?

Many thanks,
Bernhard


More information about the TYPO3-project-typo3v4mvc mailing list