Files
Phraseanet/lib/Alchemy/Phrasea/Model/Repositories/LazaretFileRepository.php
2015-03-12 15:08:24 +01:00

42 lines
988 B
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;
use Doctrine\ORM\Tools\Pagination\Paginator;
/**
* LazaretFileRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class LazaretFileRepository extends EntityRepository
{
public function findPerPage(array $base_ids, $offset = 0, $perPage = 10)
{
$builder = $this->createQueryBuilder('f');
if (! empty($base_ids)) {
$builder->where($builder->expr()->in('f.base_id', $base_ids));
}
$builder
->orderBy('f.id', 'DESC')
->setFirstResult($offset)
->setMaxResults($perPage)
;
return new Paginator($builder->getQuery(), true);
}
}