You are here

public function WorkspaceAssociation::getEntityTrackingWorkspaceIds in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::getEntityTrackingWorkspaceIds()

Gets a list of workspace IDs in which an entity is tracked.

Parameters

\Drupal\Core\Entity\RevisionableInterface $entity: An entity object.

Return value

string[] An array of workspace IDs where the given entity is tracked, or an empty array if it is not tracked anywhere.

Overrides WorkspaceAssociationInterface::getEntityTrackingWorkspaceIds

1 call to WorkspaceAssociation::getEntityTrackingWorkspaceIds()
WorkspaceAssociation::trackEntity in core/modules/workspaces/src/WorkspaceAssociation.php
Updates or creates the association for a given entity and a workspace.

File

core/modules/workspaces/src/WorkspaceAssociation.php, line 196

Class

WorkspaceAssociation
Provides a class for CRUD operations on workspace associations.

Namespace

Drupal\workspaces

Code

public function getEntityTrackingWorkspaceIds(RevisionableInterface $entity) {
  $query = $this->database
    ->select(static::TABLE)
    ->fields(static::TABLE, [
    'workspace',
  ])
    ->condition('target_entity_type_id', $entity
    ->getEntityTypeId())
    ->condition('target_entity_id', $entity
    ->id());
  return $query
    ->execute()
    ->fetchCol();
}