/** * @return int * @throws \Carrooi\NoGrid\InvalidArgumentException */ public function getCount() { // deprecated if (($count = $this->queryDefinition->getTotalCount($this->repository)) !== null) { return $count; } if (($qb = $this->queryDefinition->getTotalCountQuery($this->repository)) === null) { throw new InvalidArgumentException('Doctrine\\NativeQueryFunctionDataSource: Please implement method getTotalCountQuery().'); } foreach ($this->conditions as $condition) { BaseDataSource::makeWhere($qb, $condition); } return (int) $qb->getQuery()->getSingleScalarResult(); }
/** * @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(); }