Invoice/EventListener/AbstractInvoiceListener.php
public function onInsert(ResourceEventInterface $event)
    {
        $invoice = $this->getInvoiceFromEvent($event);

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

        // Updates the invoice data
        $changed |= $this->invoiceBuilder->update($invoice);

        // Updates the totals
        $changed |= $this->updateTotals($invoice);

        if ($changed) {
            $this->persistenceHelper->persistAndRecompute($invoice, false);
        }

        $sale = $this->getSaleFromInvoice($invoice);
        if ($sale instanceof InvoiceSubjectInterface) {
            $sale->addInvoice($invoice); // TODO wtf ?
        }

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

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

        // Updates the invoice data
        $changed |= $this->invoiceBuilder->update($invoice);

        // Updates the totals
        $changed |= $this->updateTotals($invoice);

        if ($changed) {
            $this->persistenceHelper->persistAndRecompute($invoice, false);
        }

        $sale = $this->getSaleFromInvoice($invoice);
        if ($sale instanceof InvoiceSubjectInterface) {
            $sale->addInvoice($invoice); // TODO wtf ?
        }

        $this->scheduleSaleContentChangeEvent($sale);
    }
public function onInsert ( ResourceEventInterface $ event ) { $ invoice = $ this -> getInvoiceFromEvent ( $ event ) ; // Generate number and key $ changed = $ this -> generateNumber ( $ invoice ) ; // Updates the invoice data $ changed |= $ this -> invoiceBuilder -> update ( $ invoice ) ; // Updates the totals $ changed |= $ this -> updateTotals ( $ invoice ) ; if ( $ changed ) { $ this -> persistenceHelper -> persistAndRecompute ( $ invoice , false ) ; } $ sale = $ this -> getSaleFromInvoice ( $ invoice ) ; if ( $ sale instanceof InvoiceSubjectInterface ) { $ sale -> addInvoice ( $ invoice ) ; // TODO wtf ? } $ this -> scheduleSaleContentChangeEvent ( $ sale ) ; }
Insert event handler.

@param ResourceEventInterface $event
Insert event handler .