function SqlContentEntityStorage::onFieldStorageDefinitionDelete
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::onFieldStorageDefinitionDelete()
- 8.9.x core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::onFieldStorageDefinitionDelete()
- 10 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::onFieldStorageDefinitionDelete()
Overrides ContentEntityStorageBase::onFieldStorageDefinitionDelete
File
-
core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorage.php, line 1556
Class
- SqlContentEntityStorage
- A content entity database storage implementation.
Namespace
Drupal\Core\Entity\SqlCode
public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) {
$table_mapping = $this->getTableMapping();
if ($table_mapping->requiresDedicatedTableStorage($storage_definition)) {
// Mark all data associated with the field for deletion.
$table = $table_mapping->getDedicatedDataTableName($storage_definition);
$revision_table = $table_mapping->getDedicatedRevisionTableName($storage_definition);
$this->database
->update($table)
->fields([
'deleted' => 1,
])
->execute();
if ($this->entityType
->isRevisionable()) {
$this->database
->update($revision_table)
->fields([
'deleted' => 1,
])
->execute();
}
}
// Update the field schema.
$this->wrapSchemaException(function () use ($storage_definition) {
$this->getStorageSchema()
->onFieldStorageDefinitionDelete($storage_definition);
unset($this->fieldStorageDefinitions[$storage_definition->getName()]);
$this->tableMapping = NULL;
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.