Answer the question
In order to leave comments, you need to log in
Limit in Doctrine2?
Hello. There is a request like this:
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('Activity')
->from($this->_entityName, 'Activity')
->leftJoin('Activity.patterns', 'Pattern')
->leftJoin('Pattern.metas', 'Meta')
->leftJoin('Pattern.pickups', 'Pickup')
->leftJoin('Activity.duration', 'Duration')
->andWhere(':timestapmStart >= Meta.repeat_start')
->andWhere(':timestapmStart <= Meta.repeat_end')
->andWhere(':timestapmEnd >= Meta.repeat_start')
->andWhere(':timestapmEnd <= (Meta.repeat_end + '.($interval*24*60*60).')')
->andWhere('Pickup.city = :city')
->setParameter('timestapmStart', $date->getTimestamp())
->setParameter('timestapmEnd', $dateEnd->getTimestamp())
->setParameter('city', $city);
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($qb, true);
$result = $paginator->getQuery()
->setMaxResults(3)
->getResult();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question