public function getOrderItemById($itemId, OrderInterface $order, &$hasMultiple = false)
    {
        $item = $this->itemManager->findEntityById($itemId);
        if (!$item) {
            throw new ItemNotFoundException($itemId);
        }

        $match = false;
        $orders = $this->findOrderEntityForItemWithId($itemId, true);
        if ($orders) {
            if (count($orders) > 1) {
                $hasMultiple = true;
            }
            foreach ($orders as $itemOrders) {
                if ($order === $itemOrders) {
                    $match = true;
                }
            }
        }
        if (!$match) {
            throw new OrderException('User not owner of order');
        }

        return $item;
    }
public function getOrderItemById($itemId, OrderInterface $order, &$hasMultiple = false)
    {
        $item = $this->itemManager->findEntityById($itemId);
        if (!$item) {
            throw new ItemNotFoundException($itemId);
        }

        $match = false;
        $orders = $this->findOrderEntityForItemWithId($itemId, true);
        if ($orders) {
            if (count($orders) > 1) {
                $hasMultiple = true;
            }
            foreach ($orders as $itemOrders) {
                if ($order === $itemOrders) {
                    $match = true;
                }
            }
        }
        if (!$match) {
            throw new OrderException('User not owner of order');
        }

        return $item;
    }
public function getOrderItemById ( $ itemId , OrderInterface $ order , & $ hasMultiple = false ) { $ item = $ this -> itemManager -> findEntityById ( $ itemId ) ; if ( ! $ item ) { throw new ItemNotFoundException ( $ itemId ) ; } $ match = false ; $ orders = $ this -> findOrderEntityForItemWithId ( $ itemId , true ) ; if ( $ orders ) { if ( count ( $ orders ) > 1 ) { $ hasMultiple = true ; } foreach ( $ orders as $ itemOrders ) { if ( $ order === $ itemOrders ) { $ match = true ; } } } if ( ! $ match ) { throw new OrderException ( 'User not owner of order' ) ; } return $ item ; }
Get order item by id and checks if item belongs to the order.

@param int $itemId
@param OrderInterface $order
@param bool $hasMultiple Returns if multiple orders exist for the item

@throws EntityNotFoundException
@throws ItemNotFoundException
@throws OrderException

@return null|Item
Get order item by id and checks if item belongs to the order .