function WorkspaceAssociation::getTrackedEntities
Same name in other branches
- 9 core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::getTrackedEntities()
- 10 core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::getTrackedEntities()
- 11.x core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::getTrackedEntities()
Overrides WorkspaceAssociationInterface::getTrackedEntities
1 call to WorkspaceAssociation::getTrackedEntities()
- 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 133
Class
- WorkspaceAssociation
- Provides a class for CRUD operations on workspace associations.
Namespace
Drupal\workspacesCode
public function getTrackedEntities($workspace_id, $entity_type_id = NULL, $entity_ids = NULL) {
$query = $this->database
->select(static::TABLE);
$query->fields(static::TABLE, [
'target_entity_type_id',
'target_entity_id',
'target_entity_revision_id',
])
->orderBy('target_entity_revision_id', 'ASC')
->condition('workspace', $workspace_id);
if ($entity_type_id) {
$query->condition('target_entity_type_id', $entity_type_id, '=');
if ($entity_ids) {
$query->condition('target_entity_id', $entity_ids, 'IN');
}
}
$tracked_revisions = [];
foreach ($query->execute() as $record) {
$tracked_revisions[$record->target_entity_type_id][$record->target_entity_revision_id] = $record->target_entity_id;
}
return $tracked_revisions;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.