Supplier/EventListener/SupplierDeliveryItemListener.php
protected function handleQuantityChange(SupplierDeliveryItemInterface $item)
    {
        $changeSet = $this->persistenceHelper->getChangeSet($item);

        // Delta quantity (difference between new and old)
        if (null === $orderItem = $item->getOrderItem()) {
            throw new RuntimeException("Failed to retrieve order item.");
        }
        if (null !== $stockUnit = $orderItem->getStockUnit()) {
            // TODO use packaging format
            if (0 != $deltaQuantity = floatval($changeSet['quantity'][1]) - floatval($changeSet['quantity'][0])) {
                // Update stock unit received quantity
                $this->stockUnitUpdater->updateReceived($stockUnit, $deltaQuantity, true);
            }
        } elseif ($orderItem->hasSubjectIdentity()) {
            throw new RuntimeException("Failed to retrieve stock unit.");
        }

        // Trigger the supplier order update
        if (null === $order = $orderItem->getOrder()) {
            throw new RuntimeException("Failed to retrieve order.");
        }
        $this->scheduleSupplierOrderContentChangeEvent($order);
    }
protected function handleQuantityChange(SupplierDeliveryItemInterface $item)
    {
        $changeSet = $this->persistenceHelper->getChangeSet($item);

        // Delta quantity (difference between new and old)
        if (null === $orderItem = $item->getOrderItem()) {
            throw new RuntimeException("Failed to retrieve order item.");
        }
        if (null !== $stockUnit = $orderItem->getStockUnit()) {
            // TODO use packaging format
            if (0 != $deltaQuantity = floatval($changeSet['quantity'][1]) - floatval($changeSet['quantity'][0])) {
                // Update stock unit received quantity
                $this->stockUnitUpdater->updateReceived($stockUnit, $deltaQuantity, true);
            }
        } elseif ($orderItem->hasSubjectIdentity()) {
            throw new RuntimeException("Failed to retrieve stock unit.");
        }

        // Trigger the supplier order update
        if (null === $order = $orderItem->getOrder()) {
            throw new RuntimeException("Failed to retrieve order.");
        }
        $this->scheduleSupplierOrderContentChangeEvent($order);
    }
Handle the quantity change.

@param SupplierDeliveryItemInterface $item