Ojs\JournalBundle\Entity\ArticleRepository::getCountBy PHP 메소드

getCountBy() 공개 메소드

Return article count by condition
public getCountBy ( $field, $value ) : mixed
$field
$value
리턴 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();
    }