public SqlContentEntityStorage::onFieldDefinitionDelete(FieldDefinitionInterface $field_definition)
Reacts to the deletion of a field.
Stored values should not be wiped at once, but marked as 'deleted' so that they can go through a proper purge process later on.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition being deleted.
Overrides ContentEntityStorageBase::onFieldDefinitionDelete
File
- core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 1481
Class
- SqlContentEntityStorage
- A content entity database storage implementation.
Namespace
Drupal\Core\Entity\Sql
Code
public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition) { $table_mapping = $this->getTableMapping(); $storage_definition = $field_definition->getFieldStorageDefinition(); // Mark field data as deleted. if ($table_mapping->requiresDedicatedTableStorage($storage_definition)) { $table_name = $table_mapping->getDedicatedDataTableName($storage_definition); $revision_name = $table_mapping->getDedicatedRevisionTableName($storage_definition); $this->database->update($table_name) ->fields(array('deleted' => 1)) ->condition('bundle', $field_definition->getTargetBundle()) ->execute(); if ($this->entityType->isRevisionable()) { $this->database->update($revision_name) ->fields(array('deleted' => 1)) ->condition('bundle', $field_definition->getTargetBundle()) ->execute(); } } }
Please login to continue.