Skip to content

Commit

Permalink
Pass taxon to sort helper method as first arg
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaGallinari committed Jul 4, 2024
1 parent aa1f1b2 commit 9f24f9c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __invoke(Request $request, string $slug): Response

/** @var array<string, string> $sorting */
$sorting = $request->query->all('sorting');
$sorting = $this->sortHelper->retrieveTaxonSorting($sorting, $taxon);
$sorting = $this->sortHelper->retrieveTaxonSorting($taxon, $sorting);
$size = $request->query->getInt('limit', $this->taxonDefaultPageLimit);
$page = $request->query->getInt('page', 1);

Expand Down
2 changes: 1 addition & 1 deletion src/Helper/SortHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function retrieveSearchSorting(array $sortingQueryParams = []): array
return $sortingQueryParams; // If empty it will sort by _score desc as default
}

public function retrieveTaxonSorting(array $sortingQueryParams = [], TaxonInterface $taxon): array
public function retrieveTaxonSorting(TaxonInterface $taxon, array $sortingQueryParams = []): array
{
if ($sortingQueryParams === []) {
return ['position' => 'asc'];
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/SortHelperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ public function retrieveSearchSorting(array $sortingQueryParams = []): array;
*
* @return array<string, string>
*/
public function retrieveTaxonSorting(array $sortingQueryParams = [], TaxonInterface $taxon): array;
public function retrieveTaxonSorting(TaxonInterface $taxon, array $sortingQueryParams = []): array;
}

0 comments on commit 9f24f9c

Please sign in to comment.