code: protected function preventForbiddenChange(InvoiceInterface $invoice)
      {
          if ($this->persistenceHelper->isChanged($invoice, 'type')) {
              list($old, $new) = $this->persistenceHelper->getChangeSet($invoice, 'type');
              if ($old != $new) {
                  throw new Exception\IllegalOperationException(
                      "Changing the invoice type is not yet supported."
                  );
              }
          }
      }
docs: Prevents some of the invoice's fields to change.
  
  @param InvoiceInterface $invoice
  
  @throws Exception\IllegalOperationException