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

        $changed = $this->synchronizeWithProduct($item);

        if ($changed) {
            $this->persistenceHelper->persistAndRecompute($item);

            $this->scheduleSupplierOrderContentChangeEvent($item->getOrder());
        }

        // If supplier order state is 'ordered', 'partial' or 'completed'
        if (SupplierOrderStates::isStockableState($item->getOrder()->getState())) {
            // Associated stock unit (if not exists) must be created (absolute ordered quantity).
            $this->stockUnitLinker->linkItem($item);
        } else { // Supplier order state is 'new' or 'canceled'
            // Associated stock unit (if exists) must be deleted.
            $this->stockUnitLinker->unlinkItem($item);
        }
    }
public function onInsert(ResourceEventInterface $event)
    {
        $item = $this->getSupplierOrderItemFromEvent($event);

        $changed = $this->synchronizeWithProduct($item);

        if ($changed) {
            $this->persistenceHelper->persistAndRecompute($item);

            $this->scheduleSupplierOrderContentChangeEvent($item->getOrder());
        }

        // If supplier order state is 'ordered', 'partial' or 'completed'
        if (SupplierOrderStates::isStockableState($item->getOrder()->getState())) {
            // Associated stock unit (if not exists) must be created (absolute ordered quantity).
            $this->stockUnitLinker->linkItem($item);
        } else { // Supplier order state is 'new' or 'canceled'
            // Associated stock unit (if exists) must be deleted.
            $this->stockUnitLinker->unlinkItem($item);
        }
    }
Insert event handler.

@param ResourceEventInterface $event