#[Route(path: '/account/order/edit/{orderId}', name: 'frontend.account.edit-order.page', defaults: ['_loginRequired' => true, '_loginRequiredAllowGuest' => true, '_noStore' => true], methods: ['GET'])]
#[Route(path: '/account/order/edit/{orderId}', name: 'frontend.account.edit-order.page', defaults: ['_noStore' => true], methods: ['GET'])]
public function editOrder(string
$orderId, Request
$request, SalesChannelContext
$context): Response
{ $criteria =
new Criteria([$orderId]);
$deliveriesCriteria =
$criteria->
getAssociation('deliveries'
);
$deliveriesCriteria->
addSorting(new FieldSorting('createdAt', FieldSorting::ASCENDING
));
try { /** @var OrderEntity|null $order */
$order =
$this->orderRoute->
load($request,
$context,
$criteria)->
getOrders()->
first();
} catch (InvalidUuidException
) { $order = null;
} if ($order === null
) { $this->
addFlash(self::DANGER,
$this->
trans('error.' . OrderException::ORDER_ORDER_NOT_FOUND_CODE
));
return $this->
redirectToRoute('frontend.account.order.page'
);
} if ($context->
getCurrency()->
getId() !==
$order->
getCurrencyId()) {