_em->createQuery($dql); if (null !== $offsetStart && 0 !== $offsetStart) { $query->setFirstResult($offsetStart); } if (null !== $perPage) { $query->setMaxResults($perPage); } return $query->getResult(); } /** * Returns the total number of orders from an array of base_id * * @param array $baseIds * * @return integer */ public function countTotalOrders(array $baseIds = array()) { $dql = 'SELECT distinct o.id FROM Entities\OrderElement e, Entities\Order o WHERE ' . (count($baseIds > 0 ) ? 'e.base_id IN (' . implode(', ', $baseIds) . ') AND ': '' ). 'e.order = o GROUP BY o.id'; $query = $this->_em->createQuery($dql); return count($query->getResult()); } }