Supplier/EventListener/SupplierDeliveryItemListener.php
public function onInsert(ResourceEventInterface $event)
    {
        $item = $this->getSupplierDeliveryItemFromEvent($event);

        // Credit stock unit received quantity
        if (null === $orderItem = $item->getOrderItem()) {
            throw new RuntimeException("OrderItem must be set.");
        }

        if (null !== $stockUnit = $orderItem->getStockUnit()) {
            $stockUnit->addGeocode($item->getGeocode());

            $this->stockUnitUpdater->updateReceived($stockUnit, $item->getQuantity(), true);
        } elseif ($orderItem->hasSubjectIdentity()) {
            throw new RuntimeException("Failed to retrieve stock unit.");
        }

        // Dispatch supplier order content change event
        if (null === $order = $orderItem->getOrder()) {
            throw new RuntimeException("Order must be set.");
        }

        $this->scheduleSupplierOrderContentChangeEvent($order);
    }
public function onInsert(ResourceEventInterface $event)
    {
        $item = $this->getSupplierDeliveryItemFromEvent($event);

        // Credit stock unit received quantity
        if (null === $orderItem = $item->getOrderItem()) {
            throw new RuntimeException("OrderItem must be set.");
        }

        if (null !== $stockUnit = $orderItem->getStockUnit()) {
            $stockUnit->addGeocode($item->getGeocode());

            $this->stockUnitUpdater->updateReceived($stockUnit, $item->getQuantity(), true);
        } elseif ($orderItem->hasSubjectIdentity()) {
            throw new RuntimeException("Failed to retrieve stock unit.");
        }

        // Dispatch supplier order content change event
        if (null === $order = $orderItem->getOrder()) {
            throw new RuntimeException("Order must be set.");
        }

        $this->scheduleSupplierOrderContentChangeEvent($order);
    }
Insert event handler.

@param ResourceEventInterface $event