You are here

protected function InvoiceStorage::invokeHook in Commerce Invoice 8.2

Invokes a hook on behalf of the entity.

Parameters

string $hook: One of 'create', 'presave', 'insert', 'update', 'predelete', 'delete', or 'revision_delete'.

\Drupal\Core\Entity\EntityInterface $entity: The entity object.

Overrides CommerceContentEntityStorage::invokeHook

File

src/InvoiceStorage.php, line 17

Class

InvoiceStorage

Namespace

Drupal\commerce_invoice

Code

protected function invokeHook($hook, EntityInterface $entity) {
  if ($hook == 'presave') {

    // Invoice::preSave() has completed, now run the storage-level pre-save
    // tasks. These tasks can modify the invoice, so they need to run
    // before the entity/field hooks are invoked.
    $this
      ->doInvoicePresave($entity);
  }
  parent::invokeHook($hook, $entity);
}