throw new DecorationPatternException(self::
class);
} #[Route(path: '/store-api/shipping-method', name: 'store-api.shipping.method', methods: ['GET', 'POST'], defaults: ['_entity' => 'shipping_method'])]
public function load(Request
$request, SalesChannelContext
$context, Criteria
$criteria): ShippingMethodRouteResponse
{ $criteria ->
addFilter(new EqualsFilter('active', true
)) ->
addAssociation('media'
);
if (empty($criteria->
getSorting())) { $criteria->
addSorting(new FieldSorting('position'
),
new FieldSorting('name', FieldSorting::ASCENDING
));
} $result =
$this->shippingMethodRepository->
search($criteria,
$context);
$shippingMethods =
$result->
getEntities();
if ($request->query->
getBoolean('onlyAvailable'
) ||
$request->request->
getBoolean('onlyAvailable'
)) { $shippingMethods =
$shippingMethods->
filterByActiveRules($context);
}