~tsep-dev/tsep/tsep2

« back to all changes in this revision

Viewing changes to src/TSEP/Packagist/WebBundle/Entity/PackageRepository.php

  • Committer: xaav
  • Date: 2011-10-01 18:10:50 UTC
  • Revision ID: git-v1:e1357bf55d2d528a58efeead2a02193370e17823
CS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
/*
4
 
 * This file is part of Packagist.
5
 
 *
6
 
 * (c) Jordi Boggiano <j.boggiano@seld.be>
7
 
 *     Nils Adermann <naderman@naderman.de>
8
 
 *
9
 
 * For the full copyright and license information, please view the LICENSE
10
 
 * file that was distributed with this source code.
11
 
 */
12
 
 
13
 
namespace Packagist\WebBundle\Entity;
14
 
 
15
 
use Doctrine\ORM\EntityRepository;
16
 
 
17
 
/**
18
 
 * @author Jordi Boggiano <j.boggiano@seld.be>
19
 
 */
20
 
class PackageRepository extends EntityRepository
21
 
{
22
 
    public function getStalePackages()
23
 
    {
24
 
        $qb = $this->getEntityManager()->createQueryBuilder();
25
 
        $qb->select('p, v')
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();
31
 
    }
32
 
}