|
@@ -0,0 +1,32 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+/*
|
|
|
+ * This file is part of Packagist.
|
|
|
+ *
|
|
|
+ * (c) Jordi Boggiano <j.boggiano@seld.be>
|
|
|
+ * Nils Adermann <naderman@naderman.de>
|
|
|
+ *
|
|
|
+ * 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 <j.boggiano@seld.be>
|
|
|
+ */
|
|
|
+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();
|
|
|
+ }
|
|
|
+}
|