* Nils Adermann * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Packagist\WebBundle\Entity; use Doctrine\ORM\EntityRepository; /** * @author Jordi Boggiano */ class PackageRepository extends EntityRepository { public function getStalePackages() { $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('p, v') ->from('Packagist\WebBundle\Entity\Package', 'p') ->leftJoin('p.versions', 'v') ->where('p.crawledAt IS NULL OR p.crawledAt < ?0') ->setParameters(array(new \DateTime('-1hour'))); return $qb->getQuery()->getResult(); } }