Ojs\UserBundle\Entity\UserRepository::getCountBy PHP Метод

getCountBy() публичный Метод

Return user count by condition
public getCountBy ( $field, $value ) : mixed
$field
$value
Результат mixed
    public function getCountBy($field, $value)
    {
        $qb = $this->createQueryBuilder("u");
        $qb->select("count(u.id)")->where($qb->expr()->eq("u.{$field}", ':value'))->setParameter("value", $value);
        return $qb->getQuery()->getSingleScalarResult();
    }