Shipment/Builder/InvoiceSynchronizer.php
private function persistInvoice(Invoice\InvoiceInterface $invoice)
    {
        $this->persistenceHelper->persistAndRecompute($invoice, true);

        foreach ($invoice->getLines() as $line) {
            $this->persistenceHelper->persistAndRecompute($line, true);
        }

        // Persist the shipment <-> invoice relation, without scheduling event.
        $this->persistenceHelper->persistAndRecompute($invoice->getShipment(), false);
    }
private function persistInvoice(Invoice\InvoiceInterface $invoice)
    {
        $this->persistenceHelper->persistAndRecompute($invoice, true);

        foreach ($invoice->getLines() as $line) {
            $this->persistenceHelper->persistAndRecompute($line, true);
        }

        // Persist the shipment <-> invoice relation, without scheduling event.
        $this->persistenceHelper->persistAndRecompute($invoice->getShipment(), false);
    }
Persists the invoice.

@param Invoice\InvoiceInterface $invoice