getContainer()->get(EntityManagerInterface::class); $this->em = $em; $this->em->getConnection()->executeQuery(<<em === null) { throw new \LogicException('Database has not been booted yet.'); } return $this->em; } protected function getEntityCount(string $entityClass): int { return (int) $this->getEntityManager()->createQuery('SELECT COUNT(e) FROM ' . $entityClass . ' e')->getSingleScalarResult(); } }