Shipment/EventListener/AbstractShipmentListener.php
public function onInsert(ResourceEventInterface $event)
    {
        $shipment = $this->getShipmentFromEvent($event);

        // Generate number and key
        $changed = $this->generateNumber($shipment);

        // Completed state
        $changed |= $this->handleCompletedState($shipment);

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

        $sale = $this->getSaleFromShipment($shipment);
        $sale->addShipment($shipment); // TODO wtf ?

        $this->invoiceSynchronizer->synchronize($shipment);

        $this->scheduleSaleContentChangeEvent($sale);
    }
public function onInsert(ResourceEventInterface $event)
    {
        $shipment = $this->getShipmentFromEvent($event);

        // Generate number and key
        $changed = $this->generateNumber($shipment);

        // Completed state
        $changed |= $this->handleCompletedState($shipment);

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

        $sale = $this->getSaleFromShipment($shipment);
        $sale->addShipment($shipment); // TODO wtf ?

        $this->invoiceSynchronizer->synchronize($shipment);

        $this->scheduleSaleContentChangeEvent($sale);
    }
Insert event handler.

@param ResourceEventInterface $event