replaced a dql request with querybuilder one

This commit is contained in:
Andrey
2013-08-14 18:07:05 +02:00
parent 731170343b
commit 1b8c2433b0

View File

@@ -33,20 +33,17 @@ class SessionRepository extends EntityRepository
{
$base_ids = array_keys($user->ACL()->get_granted_base());
$dql = 'SELECT f FROM Entities\Feed f
WHERE f.baseId IS NULL ';
$qb = $this->createQueryBuilder('f');
$qb->where($qb->expr()->isNull('f.baseId'))
->orWhere('f.public = true');
if (count($base_ids) > 0) {
$dql .= ' OR f.baseId
IN (' . implode(', ', $base_ids) . ') ';
if (!empty($base_ids)) {
$qb->orWhere($qb->expr()->in('f.baseId', $base_ids));
}
$dql .= ' OR f.public = true
ORDER BY f.updatedOn DESC';
$qb->orderBy('f.updatedOn', 'DESC');
$query = $this->_em->createQuery($dql);
return $query->getResult();
return $qb->getQuery()->getResult();
}
/**