Files
Phraseanet/lib/Alchemy/Phrasea/Model/Repositories/FeedEntryRepository.php
2014-01-06 15:40:56 +01:00

51 lines
1.3 KiB
PHP

<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Model\Repositories;
use Doctrine\ORM\EntityRepository;
/**
* FeedEntryRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class FeedEntryRepository extends EntityRepository
{
/**
* Returns a collection of FeedEntry from given feeds, limited to $how_many results, starting with $offset_start
*
* @param array $feeds
* @param integer $offset_start
* @param integer $how_many
*
* @return \Doctrine\Common\Collections\Collection
*/
public function findByFeeds($feeds, $offset_start = null, $how_many = null)
{
$dql = 'SELECT f FROM Alchemy\Phrasea\Model\Entities\FeedEntry f
WHERE f.feed IN (:feeds) order by f.updatedOn DESC';
$query = $this->_em->createQuery($dql);
$query->setParameter('feeds', $feeds);
if (null !== $offset_start && 0 !== $offset_start) {
$query->setFirstResult($offset_start);
}
if (null !== $how_many) {
$query->setMaxResults($how_many);
}
return $query->getResult();
}
}