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()); $base_ids = array_keys($user->ACL()->get_granted_base());
$dql = 'SELECT f FROM Entities\Feed f $qb = $this->createQueryBuilder('f');
WHERE f.baseId IS NULL '; $qb->where($qb->expr()->isNull('f.baseId'))
->orWhere('f.public = true');
if (count($base_ids) > 0) { if (!empty($base_ids)) {
$dql .= ' OR f.baseId $qb->orWhere($qb->expr()->in('f.baseId', $base_ids));
IN (' . implode(', ', $base_ids) . ') ';
} }
$dql .= ' OR f.public = true $qb->orderBy('f.updatedOn', 'DESC');
ORDER BY f.updatedOn DESC';
$query = $this->_em->createQuery($dql); return $qb->getQuery()->getResult();
return $query->getResult();
} }
/** /**