public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = []) {
        $idColumn = $idColumn !== null ? $idColumn : 'id';

        $qb = $this->createCountQuery($collection)
                   ->where('o.' . $column . ' = :value')
                   ->setParameter('value', $value);

        if (!is_null($excludeId) && $excludeId != 'NULL')  {
            $qb->andWhere('o.' . $idColumn .' <> :excludeId')
               ->setParameter('excludeId', $excludeId);
        }

        foreach($extra as $key => $extraValue) {
            $this->addWhere($qb, $key, $extraValue);
        }

        return (int) $qb->getQuery()->getSingleScalarResult();
    }
public function getCount($collection, $column, $value, $excludeId = null, $idColumn = null, array $extra = []) {
        $idColumn = $idColumn !== null ? $idColumn : 'id';

        $qb = $this->createCountQuery($collection)
                   ->where('o.' . $column . ' = :value')
                   ->setParameter('value', $value);

        if (!is_null($excludeId) && $excludeId != 'NULL')  {
            $qb->andWhere('o.' . $idColumn .' <> :excludeId')
               ->setParameter('excludeId', $excludeId);
        }

        foreach($extra as $key => $extraValue) {
            $this->addWhere($qb, $key, $extraValue);
        }

        return (int) $qb->getQuery()->getSingleScalarResult();
    }
public function getCount ( $ collection , $ column , $ value , $ excludeId = null , $ idColumn = null , array $ extra = [ ] ) { $ idColumn = $ idColumn !== null ? $ idColumn : 'id' ; $ qb = $ this -> createCountQuery ( $ collection ) -> where ( 'o.' . $ column . ' = :value' ) -> setParameter ( 'value' , $ value ) ; if ( ! is_null ( $ excludeId ) && $ excludeId != 'NULL' ) { $ qb -> andWhere ( 'o.' . $ idColumn . ' <> :excludeId' ) -> setParameter ( 'excludeId' , $ excludeId ) ; } foreach ( $ extra as $ key => $ extraValue ) { $ this -> addWhere ( $ qb , $ key , $ extraValue ) ; } return ( int ) $ qb -> getQuery ( ) -> getSingleScalarResult ( ) ; }
Count the number of objects in a collection having the given value.

@param  string $collection
@param  string $column
@param  string $value
@param  int $excludeId
@param  string $idColumn
@param  array $extra
@return int
Count the number of objects in a collection having the given value .