4
* This file is part of Packagist.
6
* (c) Jordi Boggiano <j.boggiano@seld.be>
7
* Nils Adermann <naderman@naderman.de>
9
* For the full copyright and license information, please view the LICENSE
10
* file that was distributed with this source code.
13
namespace Packagist\WebBundle\Entity;
15
use Doctrine\ORM\EntityRepository;
18
* @author Jordi Boggiano <j.boggiano@seld.be>
20
class PackageRepository extends EntityRepository
22
public function getStalePackages()
24
$qb = $this->getEntityManager()->createQueryBuilder();
26
->from('Packagist\WebBundle\Entity\Package', 'p')
27
->leftJoin('p.versions', 'v')
28
->where('p.crawledAt IS NULL OR p.crawledAt < ?0')
29
->setParameters(array(new \DateTime('-1hour')));
30
return $qb->getQuery()->getResult();