Newscoop\Entity\Repository\CommentRepository::getCommentsForAuthorArticlesPerDay PHP Method

getCommentsForAuthorArticlesPerDay() public method

Get Comments for all authors articles grouped by day
public getCommentsForAuthorArticlesPerDay ( Author $author, string $range = '-60 days' ) : Doctrine\ORM\Query
$author Newscoop\Entity\Author
$range string
return Doctrine\ORM\Query
    public function getCommentsForAuthorArticlesPerDay($author, $range = '-60 days')
    {
        $qb = $this->createQueryBuilder('c');
        $date = new \DateTime();
        $date->modify($range);
        $qb->select('COUNT(c.id) as number', "DATE_FORMAT(c.time_created, '%Y-%m-%d') as date")->leftJoin('c.article', 'a')->leftJoin('a.authors', 'aa')->andwhere('aa.id = :authorId')->andWhere('c.time_created > :date')->setParameter('authorId', $author->getId())->setParameter('date', $date)->groupBy('date');
        return $qb->getQuery();
    }