src/Factory/Invoice.php
public function save()
    {
        $oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
        if (empty($this->iId)) {
            $oInvoice = $oInvoiceModel->create($this->toArray(), true);
            if (empty($oInvoice)) {
                throw new InvoiceException($oInvoiceModel->lastError());
            }
            $this->iId  = $oInvoice->id;
            $this->sRef = $oInvoice->ref;
        } else {
            $oInvoice = $oInvoiceModel->getById($this->iId);
        }
        return $oInvoice;
    }
public function save()
    {
        $oInvoiceModel = Factory::model('Invoice', 'nails/module-invoice');
        if (empty($this->iId)) {
            $oInvoice = $oInvoiceModel->create($this->toArray(), true);
            if (empty($oInvoice)) {
                throw new InvoiceException($oInvoiceModel->lastError());
            }
            $this->iId  = $oInvoice->id;
            $this->sRef = $oInvoice->ref;
        } else {
            $oInvoice = $oInvoiceModel->getById($this->iId);
        }
        return $oInvoice;
    }
public function save ( ) { $ oInvoiceModel = Factory :: model ( 'Invoice' , 'nails/module-invoice' ) ; if ( empty ( $ this -> iId ) ) { $ oInvoice = $ oInvoiceModel -> create ( $ this -> toArray ( ) , true ) ; if ( empty ( $ oInvoice ) ) { throw new InvoiceException ( $ oInvoiceModel -> lastError ( ) ) ; } $ this -> iId = $ oInvoice -> id ; $ this -> sRef = $ oInvoice -> ref ; } else { $ oInvoice = $ oInvoiceModel -> getById ( $ this -> iId ) ; } return $ oInvoice ; }
Saves a new invoice
@return \stdClass
@throws InvoiceException
Saves a new invoice