for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace App\Repository;
use App\Entity\City;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method city|null find($id, $lockMode = null, $lockVersion = null)
* @method city|null findOneBy(array $criteria, array $orderBy = null)
* @method city[] findAll()
* @method city[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
final class CityRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
parent::__construct($registry, City::class);
}
public function countAll(): int
$count = $this->createQueryBuilder('l')
->select('count(l.id)')
->getQuery()
->getSingleScalarResult();
return (int) $count;