$criteria->
addAssociations([ 'lineItems',
'deliveries.shippingOrderAddress',
'deliveries.stateMachineState',
'orderCustomer',
'tags',
'transactions.stateMachineState',
'stateMachineState',
]);
$this->eventDispatcher->
dispatch(new OrderPaymentMethodChangedCriteriaEvent($orderId,
$criteria,
$context));
/** @var OrderEntity|null $order */
$order =
$this->orderRepository->
search($criteria,
$context->
getContext())->
first();
if ($order === null
) { throw new EntityNotFoundException('order',
$orderId);
} return $order;
}