Ojs\AnalyticsBundle\Entity\ArticleFileStatisticRepository::getTotalDownloadsOfAllFiles PHP Method

getTotalDownloadsOfAllFiles() public method

Returns the download count of the given article's files on given dates
public getTotalDownloadsOfAllFiles ( $articles, $dates = null ) : array
$articles
$dates
return array
    public function getTotalDownloadsOfAllFiles($articles, $dates = null)
    {
        $builder = $this->createQueryBuilder('stat');
        if ($dates !== null) {
            $builder->andWhere('stat.date IN (:dates)')->setParameter('dates', $dates);
        }
        $builder->join('OjsJournalBundle:ArticleFile', 'file', 'WHERE', 'stat.articleFile = file')->join('OjsJournalBundle:Article', 'article', 'WHERE', 'file.article IN (:articles)')->addSelect('SUM(stat.download)')->andWhere('article IN (:articles)')->groupBy('article, stat.id, file')->setParameter('articles', $articles);
        return $builder->getQuery()->getResult();
    }