/** * @throws \Kdyby\Doctrine\QueryException * @return int */ public function getTotalCount() { if ($this->totalCount === NULL) { try { $this->frozen = TRUE; $paginatedQuery = $this->createPaginatedQuery($this->query); if ($this->queryObject !== NULL && $this->repository !== NULL) { $this->totalCount = $this->queryObject->count($this->repository, $this, $paginatedQuery); } else { $this->totalCount = $paginatedQuery->count(); } } catch (ORMException $e) { throw new QueryException($e, $this->query, $e->getMessage()); } } return $this->totalCount; }