protected function SqlContentEntityStorage::purgeFieldItems in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::purgeFieldItems()
- 9 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::purgeFieldItems()
Removes field items from storage per entity during purge.
Parameters
ContentEntityInterface $entity: The entity revision, whose values are being purged.
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field whose values are bing purged.
Overrides ContentEntityStorageBase::purgeFieldItems
File
- core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorage.php, line 1693
Class
- SqlContentEntityStorage
- A content entity database storage implementation.
Namespace
Drupal\Core\Entity\SqlCode
protected function purgeFieldItems(ContentEntityInterface $entity, FieldDefinitionInterface $field_definition) {
$storage_definition = $field_definition
->getFieldStorageDefinition();
$is_deleted = $storage_definition
->isDeleted();
$table_mapping = $this
->getTableMapping();
$table_name = $table_mapping
->getDedicatedDataTableName($storage_definition, $is_deleted);
$revision_name = $table_mapping
->getDedicatedRevisionTableName($storage_definition, $is_deleted);
$revision_id = $this->entityType
->isRevisionable() ? $entity
->getRevisionId() : $entity
->id();
$this->database
->delete($table_name)
->condition('revision_id', $revision_id)
->condition('deleted', 1)
->execute();
if ($this->entityType
->isRevisionable()) {
$this->database
->delete($revision_name)
->condition('revision_id', $revision_id)
->condition('deleted', 1)
->execute();
}
}