function WorkspaceTracker::deleteTrackedEntities

File

core/modules/workspaces/src/WorkspaceTracker.php, line 418

Class

WorkspaceTracker
Provides a class for CRUD operations on workspace associations.

Namespace

Drupal\workspaces

Code

public function deleteTrackedEntities(?string $workspace_id = NULL, ?string $entity_type_id = NULL, ?array $entity_ids = NULL, ?array $revision_ids = NULL) : void {
  if (!$workspace_id && !$entity_type_id) {
    throw new \InvalidArgumentException('A workspace ID or an entity type ID must be provided.');
  }
  try {
    $transaction = $this->database
      ->startTransaction();
    $this->doDeleteAssociations(static::TABLE, $workspace_id, $entity_type_id, $entity_ids, $revision_ids);
    $this->doDeleteAssociations(static::REVISION_TABLE, $workspace_id, $entity_type_id, $entity_ids, $revision_ids);
  } catch (\Exception $e) {
    if (isset($transaction)) {
      $transaction->rollBack();
    }
    Error::logException($this->logger, $e);
    throw $e;
  }
  $this->associatedRevisions = $this->associatedInitialRevisions = [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.