diff --git a/lib/Core/Site/QueryType/Location/Children.php b/lib/Core/Site/QueryType/Location/Children.php index ee0fc035..638b9c73 100644 --- a/lib/Core/Site/QueryType/Location/Children.php +++ b/lib/Core/Site/QueryType/Location/Children.php @@ -53,18 +53,21 @@ protected function configureOptions(OptionsResolver $resolver): void $resolver->setRequired('location'); $resolver->setAllowedTypes('location', SiteLocation::class); - $resolver->setDefault('sort', static function (Options $options): array { - /** @var \Netgen\EzPlatformSiteApi\API\Values\Location $location */ - $location = $options['location']; + $resolver->setDefault( + 'sort', + function (Options $options): array { + /** @var \Netgen\EzPlatformSiteApi\API\Values\Location $location */ + $location = $options['location']; - try { - return $location->innerLocation->getSortClauses(); - } catch (NotImplementedException $e) { - $this->logger->notice("Cannot use sort clausses from parent location: {$e->getMessage()}"); + try { + return $location->innerLocation->getSortClauses(); + } catch (NotImplementedException $e) { + $this->logger->notice("Cannot use sort clauses from parent location: {$e->getMessage()}"); - return []; + return []; + } } - }); + ); } /** diff --git a/lib/Core/Site/QueryType/Location/Siblings.php b/lib/Core/Site/QueryType/Location/Siblings.php index d91df09a..c2325d2f 100644 --- a/lib/Core/Site/QueryType/Location/Siblings.php +++ b/lib/Core/Site/QueryType/Location/Siblings.php @@ -56,14 +56,14 @@ protected function configureOptions(OptionsResolver $resolver): void $resolver->setDefault( 'sort', - static function (Options $options): array { + function (Options $options): array { /** @var \Netgen\EzPlatformSiteApi\API\Values\Location $location */ $location = $options['location']; try { return $location->parent->innerLocation->getSortClauses(); } catch (NotImplementedException $e) { - $this->logger->notice("Cannot use sort clausses from parent location: {$e->getMessage()}"); + $this->logger->notice("Cannot use sort clauses from parent location: {$e->getMessage()}"); return []; } diff --git a/lib/Core/Site/Values/Location.php b/lib/Core/Site/Values/Location.php index 2b8d637c..99feb362 100644 --- a/lib/Core/Site/Values/Location.php +++ b/lib/Core/Site/Values/Location.php @@ -225,18 +225,18 @@ public function filterSiblings(array $contentTypeIdentifiers = [], int $maxPerPa private function getFilterPager(array $criteria, int $maxPerPage = 25, int $currentPage = 1): Pagerfanta { try { - $sortClausses = $this->innerLocation->getSortClauses(); + $sortClauses = $this->innerLocation->getSortClauses(); } catch (NotImplementedException $e) { - $this->logger->notice("Cannot use sort clausses from parent location: {$e->getMessage()}"); + $this->logger->notice("Cannot use sort clauses from parent location: {$e->getMessage()}"); - $sortClausses = []; + $sortClauses = []; } $pager = new Pagerfanta( new FilterAdapter( new LocationQuery([ 'filter' => new LogicalAnd($criteria), - 'sortClauses' => $sortClausses, + 'sortClauses' => $sortClauses, ]), $this->site->getFilterService() )