[Flow] custom query with limit


i’ve the following problem. I use the \TYPO3\Flow\Persistence\Doctrine\Repository for one of my repositories because i have a completely individual query. In that query i use groupBy, orderBy and also limit. The problem is to set the limit. My DQL completely ignore the limit values. But i don’t know why.

Here an example of my Query:

$builder = $this->entityManager->createQueryBuilder('\Orangefluid\Orangelab\Domain\Model\TimeTracking');
$builder->select(array('tt','sum(tt.period) as period, max(tt.date) as maxDate'))
->from('\Orangefluid\Orangelab\Domain\Model\TimeTracking', 'tt');

if(!empty($from) && !empty($to)) {
$builder->where('tt.date >= '.$from)->andWhere('tt.date <= '.$to);

$builder->andWhere('tt.user = ' .$user->getUid());
$group = intval($group);
if($group === 1) {
}else {

$builder->orderBy('maxDate', 'DESC');

$query = $builder->getDQL();

$tmpReports = $this->entityManager->createQuery($query)->execute();

Can anyone help me? Or can i do that query with the flow basics too?


DQL ist the way to go, but I would probably also ask in the Doctrine IRC or forums as this has nothing to do with Flow. You might want to debug the resulting SQL query, maybe that gives you some hints, but I have no good idea.