function FieldPurger::purgeFieldStorageDefinition
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Field/FieldPurger.php \Drupal\Core\Field\FieldPurger::purgeFieldStorageDefinition()
Purges a field storage definition from the database.
This function assumes all fields for the field storage has already been purged, and should only be called by purgeBatch().
Parameters
\Drupal\Core\Field\FieldStorageDefinitionInterface $field_storage: The field storage definition to purge.
Throws
\Drupal\Core\Field\FieldException
File
-
core/
lib/ Drupal/ Core/ Field/ FieldPurger.php, line 169
Class
Namespace
Drupal\Core\FieldCode
protected function purgeFieldStorageDefinition(FieldStorageDefinitionInterface $field_storage) : void {
$fields = $this->deletedFieldsRepository
->getFieldDefinitions($field_storage->getUniqueStorageIdentifier());
if (count($fields) > 0) {
throw new FieldException("Attempt to purge a field storage {$field_storage->getName()} that still has fields.");
}
$this->deletedFieldsRepository
->removeFieldStorageDefinition($field_storage);
// Notify the storage layer.
$this->entityTypeManager
->getStorage($field_storage->getTargetEntityTypeId())
->finalizePurge($field_storage);
// Invoke external hooks after the cache is cleared for API consistency.
$this->moduleHandler
->invokeAll('field_purge_field_storage', [
$field_storage,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.