code: public function onPreUpdate(ResourceEventInterface $event)
      {
          $invoice = $this->getInvoiceFromEvent($event);
  
          /*if (null !== $invoice->getShipment()) {
              throw new Exception\IllegalOperationException(
                  "Invoice (or credit) associated with a shipment (or return) can't be modified."
              );
          }*/
  
          // Pre load sale's invoices collection
          /** @var InvoiceSubjectInterface $sale */
          $sale = $invoice->getSale();
          $sale->getInvoices()->toArray();
      }
docs: Pre update event handler.
  
  @param ResourceEventInterface $event