private function EntityUpdateService::doEntityUpdate in Entity Construction Kit (ECK) 8
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 EntityUpdateService::doEntityUpdate()
- EntityUpdateService::applyUpdates in src/
EntityUpdateService.php - Applies all the detected valid changes.
File
- src/
EntityUpdateService.php, line 143
Class
- EntityUpdateService
- Class to update entity and field storage for ECK entities.
Namespace
Drupal\eckCode
private function doEntityUpdate($op, $entity_type_id) {
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
switch ($op) {
case EntityDefinitionUpdateManagerInterface::DEFINITION_CREATED:
$this->entityTypeListener
->onEntityTypeCreate($entity_type);
break;
case EntityDefinitionUpdateManagerInterface::DEFINITION_UPDATED:
$original = $this->entityLastInstalledSchemaRepository
->getLastInstalledDefinition($entity_type_id);
$storage = $this->entityTypeManager
->getStorage($entity_type
->id());
if ($storage instanceof EntityStorageSchemaInterface && $storage
->requiresEntityDataMigration($entity_type, $original)) {
throw new \InvalidArgumentException('The entity schema update for the ' . $entity_type
->id() . ' entity type requires a data migration.');
}
$field_storage_definitions = $this->entityFieldManager
->getFieldStorageDefinitions($entity_type_id);
$original_field_Storage_definitions = $this->entityLastInstalledSchemaRepository
->getLastInstalledFieldStorageDefinitions($entity_type_id);
$this->entityTypeListener
->onFieldableEntityTypeUpdate($entity_type, $original, $field_storage_definitions, $original_field_Storage_definitions);
break;
}
}