Skip to content

Commit

Permalink
Clean ups
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek authored Nov 26, 2024
1 parent 956d0ac commit 359ac63
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/Controller/PackageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,13 @@ public function allAction(): RedirectResponse
public function listAction(Request $req,
PackageRepository $repo,
#[MapQueryParameter] ?string $type=null,
#[MapQueryParameter] ?string $vendor=null
#[MapQueryParameter] ?string $vendor=null,
): JsonResponse
{
$queryParams = $req->query->all();
$fields = (array) ($queryParams['fields'] ?? []); // support single or multiple fields
$fields = array_intersect($fields, ['repository', 'type', 'abandoned']);

$qb = $repo->createQueryBuilder('p');
if ($type) {
$qb->andWhere('p.type = :type')->setParameter('type', $type);
}
if ($vendor) {
$qb->andWhere('p.vendor = :vendor')->setParameter('vendor', $vendor);
}

$query = $qb->getQuery();
// dd($fields, $query->getResult());

if (count($fields) > 0) {
$filters = array_filter([
'type' => $type,
Expand Down

0 comments on commit 359ac63

Please sign in to comment.