Newscoop\Entity\Repository\ArticleRepository::countByAuthor PHP Метод

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

Get articles count for user if is author.
public countByAuthor ( User $user ) : integer
$user Newscoop\Entity\User
Результат integer
    public function countByAuthor(User $user)
    {
        $qb = $this->getEntityManager()->createQueryBuilder();
        $qb->select('count(a)')->from('Newscoop\\Entity\\Article', 'a')->from('Newscoop\\Entity\\ArticleAuthor', 'aa')->from('Newscoop\\Entity\\User', 'u')->where('a.number = aa.articleNumber')->andWhere('a.language = aa.languageId')->andWhere('aa.author = u.author')->andwhere('u.id = :user')->andWhere($qb->expr()->in('a.type', array('news', 'blog')))->andWhere('a.workflowStatus = :status')->setParameters(array('user' => $user->getId(), 'status' => Article::STATUS_PUBLISHED));
        $count = $qb->getQuery()->getSingleScalarResult();
        return (int) $count;
    }