replaced repository methods with query-builder ones

This commit is contained in:
Andrey
2013-08-13 19:57:21 +02:00
parent 3b3d08a9e1
commit 090f230dd9
3 changed files with 38 additions and 25 deletions

View File

@@ -78,14 +78,16 @@ class SessionRepository extends EntityRepository
* @param array $feed_id
* @return Collection
*/
public function findByIdArray(array $feed_id)
{
$dql = 'SELECT f FROM Entities\Feed f
ORDER BY f.created_on DESC
WHERE f.id IN (' . implode(",", $feed_id) . ')';
public function findByIds(array $feedIds)
{
$qb = $this->createQueryBuilder('f');
$query = $this->_em->createQuery($dql);
return $query->getResult();
if (!empty($feedIds)) {
$qb->Where($qb->expr()->in('f.id', $feedIds));
}
$qb->orderBy('f.updated_on', 'DESC');
return $qb->getQuery()->getResult();
}
}