src/Repository/ModRepository.php
public function count(array $modCombinationIds = []): int
    {
        $queryBuilder = $this->entityManager->createQueryBuilder();
        $queryBuilder->select('COUNT(DISTINCT m.id) AS numberOfMods')
                     ->from(Mod::class, 'm');

        if (count($modCombinationIds) > 0) {
            $queryBuilder->innerJoin('m.combinations', 'mc')
                         ->andWhere('mc.id IN (:modCombinationIds)')
                         ->setParameter('modCombinationIds', array_values($modCombinationIds));
        }

        try {
            $result = (int) $queryBuilder->getQuery()->getSingleScalarResult();
        } catch (NonUniqueResultException $e) {
            $result = 0;
        }
        return $result;
    }
public function count(array $modCombinationIds = []): int
    {
        $queryBuilder = $this->entityManager->createQueryBuilder();
        $queryBuilder->select('COUNT(DISTINCT m.id) AS numberOfMods')
                     ->from(Mod::class, 'm');

        if (count($modCombinationIds) > 0) {
            $queryBuilder->innerJoin('m.combinations', 'mc')
                         ->andWhere('mc.id IN (:modCombinationIds)')
                         ->setParameter('modCombinationIds', array_values($modCombinationIds));
        }

        try {
            $result = (int) $queryBuilder->getQuery()->getSingleScalarResult();
        } catch (NonUniqueResultException $e) {
            $result = 0;
        }
        return $result;
    }
public function count ( array $ modCombinationIds = [ ] ) : int { $ queryBuilder = $ this -> entityManager -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'COUNT(DISTINCT m.id) AS numberOfMods' ) -> from ( Mod :: class , 'm' ) ; if ( count ( $ modCombinationIds ) > 0 ) { $ queryBuilder -> innerJoin ( 'm.combinations' , 'mc' ) -> andWhere ( 'mc.id IN (:modCombinationIds)' ) -> setParameter ( 'modCombinationIds' , array_values ( $ modCombinationIds ) ) ; } try { $ result = ( int ) $ queryBuilder -> getQuery ( ) -> getSingleScalarResult ( ) ; } catch ( NonUniqueResultException $ e ) { $ result = 0 ; } return $ result ; }
Counts the mods.
@param array|int[] $modCombinationIds
@return int
Counts the mods .