You are here

protected function SqlContentEntityStorage::doDeleteFieldItems in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::doDeleteFieldItems()
  2. 10 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::doDeleteFieldItems()

Deletes entity field values from the storage.

Parameters

\Drupal\Core\Entity\ContentEntityInterface[] $entities: An array of entity objects to be deleted.

Overrides ContentEntityStorageBase::doDeleteFieldItems

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 765

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

protected function doDeleteFieldItems($entities) {
  $ids = array_keys($entities);
  $this->database
    ->delete($this->baseTable)
    ->condition($this->idKey, $ids, 'IN')
    ->execute();
  if ($this->revisionTable) {
    $this->database
      ->delete($this->revisionTable)
      ->condition($this->idKey, $ids, 'IN')
      ->execute();
  }
  if ($this->dataTable) {
    $this->database
      ->delete($this->dataTable)
      ->condition($this->idKey, $ids, 'IN')
      ->execute();
  }
  if ($this->revisionDataTable) {
    $this->database
      ->delete($this->revisionDataTable)
      ->condition($this->idKey, $ids, 'IN')
      ->execute();
  }
  foreach ($entities as $entity) {
    $this
      ->deleteFromDedicatedTables($entity);
  }
}