You are here

public function ContentEntityStorage::doDelete in MongoDB 8

Deletes permanently saved entities.

Parameters

array $entities: An array of entity objects to delete.

Throws

\Drupal\Core\Entity\EntityStorageException In case of failures, an exception is thrown.

Overrides ContentEntityStorageBase::doDelete

File

src/Entity/ContentEntityStorage.php, line 159
Contains Drupal\mongodb\Entity\ContentEntityStorage.

Class

ContentEntityStorage

Namespace

Drupal\mongodb\Entity

Code

public function doDelete($entities) {
  if (!$entities) {

    // If no IDs or invalid IDs were passed, do nothing.
    return;
  }
  $ids = array(
    '$in' => array_keys($entities),
  );
  $this->mongo
    ->get('entity.' . $this->entityType
    ->id())
    ->remove(array(
    '_id' => $ids,
  ));
  $this->mongo
    ->get('entity_revision.' . $this->entityType
    ->id())
    ->remove(array(
    'entity_id' => $ids,
  ));
}