You are here

protected function EntityDefinitionUpdateManager::doEntityUpdate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php \Drupal\Core\Entity\EntityDefinitionUpdateManager::doEntityUpdate()

Performs an entity type definition update.

Parameters

string $op: The operation to perform, either static::DEFINITION_CREATED or static::DEFINITION_UPDATED.

string $entity_type_id: The entity type ID.

1 call to EntityDefinitionUpdateManager::doEntityUpdate()
EntityDefinitionUpdateManager::applyUpdates in core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php
Applies all the detected valid changes.

File

core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php, line 212
Contains \Drupal\Core\Entity\EntityDefinitionUpdateManager.

Class

EntityDefinitionUpdateManager
Manages entity definition updates.

Namespace

Drupal\Core\Entity

Code

protected function doEntityUpdate($op, $entity_type_id) {
  $entity_type = $this->entityManager
    ->getDefinition($entity_type_id);
  switch ($op) {
    case static::DEFINITION_CREATED:
      $this->entityManager
        ->onEntityTypeCreate($entity_type);
      break;
    case static::DEFINITION_UPDATED:
      $original = $this->entityManager
        ->getLastInstalledDefinition($entity_type_id);
      $this->entityManager
        ->onEntityTypeUpdate($entity_type, $original);
      break;
  }
}