*/ class BucketRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Bucket::class); } public function countOverflowBucketsForScenario(Scenario $scenario, ?UuidV7 $excludeId = null): int { $qb = $this->createQueryBuilder('b') ->select('COUNT(b.id)') ->andWhere('b.scenario = :scenario') ->andWhere('b.type = :overflow') ->setParameter('scenario', $scenario) ->setParameter('overflow', BucketType::OVERFLOW); if (null !== $excludeId) { $qb->andWhere('b.id != :excludeId') ->setParameter('excludeId', $excludeId, 'uuid'); } return (int) $qb->getQuery()->getSingleScalarResult(); } }