You are here

protected function OrderStorage::invokeHook in Commerce Core 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

modules/order/src/OrderStorage.php, line 103

Class

OrderStorage
Defines the order storage.

Namespace

Drupal\commerce_order

Code

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

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