public function countAll() { $query = $this->getEntityManager()->createQueryBuilder()->select('COUNT(u)')->from($this->getEntityName(), 'u')->getQuery(); return (int) $query->getSingleScalarResult(); }