Repository/BaseOrderRepository.php
public function countByState($state = BaseOrder::STATE_IN_PROGRESS)
    {
        $qb = $this->createQueryBuilder('o')
            ->select('COUNT(o)')
            ->where('o.state = :state')
            ->setParameter('state', $state);

        return $qb->getQuery()->getSingleScalarResult();
    }
public function countByState($state = BaseOrder::STATE_IN_PROGRESS)
    {
        $qb = $this->createQueryBuilder('o')
            ->select('COUNT(o)')
            ->where('o.state = :state')
            ->setParameter('state', $state);

        return $qb->getQuery()->getSingleScalarResult();
    }
@param string $state

@return mixed