You are here

public function CustomEntityDefinitionUpdateManager::doFieldUpdate in Entity Update 2.0.x

Performs a field storage definition update.

Parameters

string $op: The operation to perform, possible values are:

\Drupal\Core\Field\FieldStorageDefinitionInterface|null $storage_definition: (optional) The new field storage definition. Defaults to none.

\Drupal\Core\Field\FieldStorageDefinitionInterface|null $original_storage_definition: (optional) The original field storage definition. Defaults to none.

1 call to CustomEntityDefinitionUpdateManager::doFieldUpdate()
CustomEntityDefinitionUpdateManager::applyUpdates in src/CustomEntityDefinitionUpdateManager.php
Applies all the detected valid changes.

File

src/CustomEntityDefinitionUpdateManager.php, line 190

Class

CustomEntityDefinitionUpdateManager
Development version of the entity definition update manager.

Namespace

Drupal\entity_update

Code

public function doFieldUpdate($op, FieldStorageDefinitionInterface $storage_definition = NULL, FieldStorageDefinitionInterface $original_storage_definition = NULL) {
  switch ($op) {
    case EntityDefinitionUpdateManagerInterface::DEFINITION_CREATED:
      $this->fieldStorageDefinitionListener
        ->onFieldStorageDefinitionCreate($storage_definition);
      break;
    case EntityDefinitionUpdateManagerInterface::DEFINITION_UPDATED:
      if ($storage_definition && $original_storage_definition) {
        $this->fieldStorageDefinitionListener
          ->onFieldStorageDefinitionUpdate($storage_definition, $original_storage_definition);
      }
      break;
    case EntityDefinitionUpdateManagerInterface::DEFINITION_DELETED:
      if ($original_storage_definition) {
        $this->fieldStorageDefinitionListener
          ->onFieldStorageDefinitionDelete($original_storage_definition);
      }
      break;
  }
}