[Flow] custom query with limit
Steffen Wickham
steffen at gaming-inc.de
Mon Feb 22 11:31:37 CET 2016
Hello Pascal,
this mailing list has been closed, please head over to
https://discuss.neos.io and post your question over there.
Best regards,
Steffen
Am 22.02.16 um 11:06 schrieb Pascal Geldmacher:
> Hi,
>
> 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);
> }
>
> if(!empty($user)){
> $builder->andWhere('tt.user = ' .$user->getUid());
> }
> $group = intval($group);
> if($group === 1) {
> $builder->groupBy('tt.project');
> }else {
> $builder->groupBy('tt.uid');
> }
>
> $builder->orderBy('maxDate', 'DESC');
> $builder->setFirstResult(0);
> $builder->setMaxResults(10);
>
> $query = $builder->getDQL();
>
> $tmpReports =
> $this->entityManager->createQuery($query)->execute();
>
> Can anyone help me? Or can i do that query with the flow basics too?
>
> Thanks
>
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
More information about the Flow
mailing list