Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::purgeFieldData()
  2. 9 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::purgeFieldData()

Purges a batch of field data.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The deleted field whose data is being purged.

int $batch_size: The maximum number of field data records to purge before returning, relating to the count of field data records returned by \Drupal\Core\Entity\FieldableEntityStorageInterface::countFieldData().

Return value

int The number of field data records that have been purged.

Overrides FieldableEntityStorageInterface::purgeFieldData

File

core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 556

Class

ContentEntityStorageBase
Base class for content entity storage handlers.

Namespace

Drupal\Core\Entity

Code

public function purgeFieldData(FieldDefinitionInterface $field_definition, $batch_size) {
  $items_by_entity = $this
    ->readFieldItemsToPurge($field_definition, $batch_size);
  foreach ($items_by_entity as $items) {
    $items
      ->delete();
    $this
      ->purgeFieldItems($items
      ->getEntity(), $field_definition);
  }
  return count($items_by_entity);
}