mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 14:33:14 +00:00
replaced a dql request with querybuilder one
This commit is contained in:
@@ -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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user