private function DevelEntityDefinitionUpdateManager::doEntityUpdate in Devel Entity Updates 3.x
Same name and namespace in other branches
- 8.2 src/DevelEntityDefinitionUpdateManager.php \Drupal\devel_entity_updates\DevelEntityDefinitionUpdateManager::doEntityUpdate()
- 8 src/DevelEntityDefinitionUpdateManager.php \Drupal\devel_entity_updates\DevelEntityDefinitionUpdateManager::doEntityUpdate()
- 3.0.x src/DevelEntityDefinitionUpdateManager.php \Drupal\devel_entity_updates\DevelEntityDefinitionUpdateManager::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 DevelEntityDefinitionUpdateManager::doEntityUpdate()
- DevelEntityDefinitionUpdateManager::applyUpdates in src/
DevelEntityDefinitionUpdateManager.php - Applies all the detected valid changes.
File
- src/
DevelEntityDefinitionUpdateManager.php, line 158
Class
- DevelEntityDefinitionUpdateManager
- Development version of the entity definition update manager.
Namespace
Drupal\devel_entity_updatesCode
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;
}
}