function WorkspaceTracker::getAllTrackedRevisions

Retrieves all content revisions tracked by a given workspace.

Since the 'workspace_association' index table only tracks the latest associated revisions, this method retrieves all the tracked revisions by querying the entity type's revision table directly.

Parameters

string $workspace_id: The ID of the workspace.

string $entity_type_id: An entity type ID to find revisions for.

int[]|string[]|null $entity_ids: (optional) An array of entity IDs to filter the results by. Defaults to NULL.

Return value

array Returns an array where the values are an array of entity IDs keyed by revision IDs.

Overrides WorkspaceTrackerInterface::getAllTrackedRevisions

1 call to WorkspaceTracker::getAllTrackedRevisions()
WorkspaceTracker::moveTrackedEntities in core/modules/workspaces/src/WorkspaceTracker.php
Moves tracked entities from one workspace to another.

File

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

Class

WorkspaceTracker
Provides a class for CRUD operations on workspace associations.

Namespace

Drupal\workspaces

Code

public function getAllTrackedRevisions(string $workspace_id, string $entity_type_id, ?array $entity_ids = NULL) : array {
  $this->loadAssociatedRevisions($workspace_id);
  if ($entity_ids) {
    return array_intersect($this->associatedRevisions[$workspace_id][$entity_type_id] ?? [], $entity_ids);
  }
  else {
    return $this->associatedRevisions[$workspace_id][$entity_type_id] ?? [];
  }
}

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