Skip to content

Commit

Permalink
Remove dead code and weak checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek authored Nov 26, 2024
1 parent 359ac63 commit 98a71d8
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions src/Entity/PackageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,6 @@ public function getProvidedNames(): array
return array_map('strtolower', $names);
}

/**
* @return array<string>
*/
public function getPackageNamesByType(string $type): array
{
$query = $this->getEntityManager()
->createQuery("SELECT p.name FROM App\Entity\Package p WHERE p.type = :type AND p.frozen IS NULL")
->setParameters(['type' => $type]);

return $this->getPackageNamesForQuery($query);
}

/**
* @return array<string>
*/
public function getPackageNamesByVendor(string $vendor): array
{
$query = $this->getEntityManager()
->createQuery("SELECT p.name FROM App\Entity\Package p WHERE p.vendor = :vendor AND p.frozen IS NULL")
->setParameters(['vendor' => $vendor]);

return $this->getPackageNamesForQuery($query);
}

/**
* @return array<string>
*/
Expand All @@ -128,11 +104,11 @@ public function getPackageNamesByTypeAndVendor(?string $type, ?string $vendor):
$qb = $this->getEntityManager()->getRepository(Package::class)->createQueryBuilder('p')
->select('p.name')
->where('p.frozen IS NULL');
if ($type) {
if ($type !== null) {
$qb->andWhere('p.type = :type')
->setParameter('type', $type);
}
if ($vendor) {
if ($vendor !== null) {
$qb->andWhere('p.vendor = :vendor')
->setParameter('vendor', $vendor);
}
Expand Down

0 comments on commit 98a71d8

Please sign in to comment.