Skip to content

Commit

Permalink
Filter out future releases, fixes #723
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Sep 12, 2016
1 parent 712b179 commit 0791cbd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Packagist/WebBundle/Entity/VersionRepository.php
Expand Up @@ -130,19 +130,21 @@ public function getQueryBuilderForLatestVersionWithPackage($vendor = null, $pack
$qb->select('v')
->from('Packagist\WebBundle\Entity\Version', 'v')
->where('v.development = false')
->andWhere('v.releasedAt <= ?0')
->orderBy('v.releasedAt', 'DESC');
$qb->setParameter(0, date('Y-m-d H:i:s'));

if ($vendor || $package) {
$qb->innerJoin('v.package', 'p')
->addSelect('p');
}

if ($vendor) {
$qb->andWhere('p.name LIKE ?0');
$qb->setParameter(0, $vendor.'/%');
$qb->andWhere('p.name LIKE ?1');
$qb->setParameter(1, $vendor.'/%');
} elseif ($package) {
$qb->andWhere('p.name = ?0')
->setParameter(0, $package);
$qb->andWhere('p.name = ?1')
->setParameter(1, $package);
}

return $qb;
Expand Down

0 comments on commit 0791cbd

Please sign in to comment.