Ojs\JournalBundle\Entity\ArticleRepository::getCountBy PHP Method

getCountBy() public method

Return article count by condition
public getCountBy ( $field, $value ) : mixed
$field
$value
return mixed
    public function getCountBy($field, $value)
    {
        $qb = $this->createQueryBuilder("a");
        $qb->select("count(a.id)")->where($qb->expr()->eq("a.{$field}", ':value'))->setParameter("value", $value);
        return $qb->getQuery()->getSingleScalarResult();
    }