Ojs\JournalBundle\Entity\JournalRepository::getHomePageList PHP Method

getHomePageList() public method

public getHomePageList ( FileCache $cache )
$cache Doctrine\Common\Cache\FileCache
    public function getHomePageList(FileCache $cache)
    {
        if (!$cache->contains('home_journal_offset')) {
            $cache->save('home_journal_offset', rand(0, $this->getJournalCount()), 3600);
        }
        $cachedOffset = $cache->fetch('home_journal_offset');
        $list = $this->createQueryBuilder('j')->select('partial j.{id,slug,issn,image,totalArticleView,totalArticleDownload,founded}, partial i.{id,slug}')->join('j.publisher', 'i')->andWhere('j.status = :status')->setParameter('status', JournalStatuses::STATUS_PUBLISHED)->setFirstResult(rand(0, $this->getJournalCount()))->setFirstResult($cachedOffset)->setMaxResults(12)->getQuery()->useQueryCache(true)->useResultCache(true, 3600)->getResult(Query::HYDRATE_OBJECT);
        return $list;
    }