Exemplo n.º 1
0
 /**
  * @return int
  */
 public function getCount()
 {
     foreach ($this->conditions as $condition) {
         BaseDataSource::makeWhere($this->qb, $condition);
     }
     return (new Paginator($this->qb->getQuery()))->count();
 }
 /**
  * @return int
  * @throws \Doctrine\ORM\Query\QueryException
  */
 public function getCount()
 {
     // deprecated
     if (($count = $this->queryDefinition->getTotalCount($this->repository)) !== null) {
         return $count;
     }
     $custom = false;
     if ($qb = $this->queryDefinition->getTotalCountQuery($this->repository)) {
         $custom = true;
     } else {
         $qb = $this->getQueryBuilder();
     }
     foreach ($this->conditions as $condition) {
         BaseDataSource::makeWhere($qb, $condition);
     }
     return $custom ? (int) $qb->getQuery()->getSingleScalarResult() : (new Paginator($this->getQueryBuilder()->getQuery()))->count();
 }
 /**
  * @return array
  */
 public function fetchData()
 {
     $query = $this->getQuery();
     foreach ($this->conditions as $condition) {
         BaseDataSource::makeWhere($query, $condition);
     }
     $data = $query->getQuery()->getResult($this->getHydrationMode());
     if ($postFetch = $this->queryDefinition->postFetch($this->repository, $data)) {
         $data = $postFetch;
     }
     return $data;
 }