Hi i want to cache the result of query. I have already:
$now = time();
$lastMonth = 30*24*3600;
$period = $now-$lastMonth;
$qb=$this->_em->createQueryBuilder()
->select('s')
->addSelect('u')
->addSelect('COUNT(s.id) AS suggestedCount')
->from('WallBundle:Status', 's')
->innerJoin('s.user', 'u')
->where('s.time >= :period')
->andWhere('s.suggested_status = true')
->groupBy('s.user')
->setParameter('period', $period)
->orderBy('suggestedCount', 'DESC')
->setMaxResults(10)
;
$query=$qb->getQuery();
$query->useResultCache(true,30800,'elite10');
$query->useQueryCache(true);
return $query->getResult();
But it still does not cache. When i remove the
"->where('s.time >= :period')"
and
->setParameter('period', $period)
It works... so.. where is the problem?