getOrderById example

private readonly EventDispatcherInterface $eventDispatcher
    ) {
    }

    /** * @param array<string> $overrideOptions * * @throws InconsistentCriteriaIdsException */
    public function restoreByOrder(string $orderId, Context $context, array $overrideOptions = []): SalesChannelContext
    {
        $order = $this->getOrderById($orderId$context);
        if ($order === null) {
            throw OrderException::orderNotFound($orderId);
        }

        if ($order->getOrderCustomer() === null) {
            throw OrderException::missingAssociation('orderCustomer');
        }

        $customer = $order->getOrderCustomer()->getCustomer();
        $customerGroupId = null;
        if ($customer) {
            


    /** * Helper function which gets the formatted order data for the passed order id. * This function is used if the order status changed and the status mail will be * send. * * @param int $orderId */
    private function getOrderForStatusMail($orderId)
    {
        $order = $this->getOrderById($orderId);
        $attributes = $this->attributeLoader->load('s_order_attributes', $orderId);
        unset($attributes['id']$attributes['orderID']);

        $order['attributes'] = $attributes;

        return $order;
    }

    /** * Helper function which converts all HTML entities, in the passed user data array, * to their applicable characters. * * @return array */
Home | Imprint | This part of the site doesn't use cookies.