You are here

public function EntityUpdateManager::destruct in Entity Usage 8.3

Performs destruct operations.

Overrides DestructableInterface::destruct

File

src/EntityUpdateManager.php, line 126

Class

EntityUpdateManager
Class EntityUpdateManager.

Namespace

Drupal\entity_usage

Code

public function destruct() {
  if (empty($this->topLevelSources)) {
    return;
  }
  foreach ($this->topLevelSources as $source) {
    switch ($source['operation']) {
      case self::OPERATION_INSERT:
        $this
          ->trackUpdateOnCreation($source['entity']);
        break;
      case self::OPERATION_UPDATE:
        $this
          ->trackUpdateOnEdition($source['entity'], $source['original']);
        break;
      case self::OPERATION_ENTITY_DELETE:
        $this
          ->trackUpdateOnDeletion($source['entity']);
        break;
      case self::OPERATION_TRANSLATION_DELETE:
        $this
          ->trackUpdateOnDeletion($source['entity'], 'translation');
        break;
      case self::OPERATION_REVISION_DELETE:
        $this
          ->trackUpdateOnDeletion($source['entity'], 'revision');
        break;
    }
  }
  $this
    ->resetProperties();
}