function WorkspaceTracker::getIdField

Same name and namespace in other branches
  1. 11.x core/modules/workspaces/src/WorkspaceTracker.php \Drupal\workspaces\WorkspaceTracker::getIdField()

Determines the target ID field name for an entity type.

@internal

Parameters

string $entity_type_id: The entity type ID.

Return value

string The name of the workspace association target ID field.

9 calls to WorkspaceTracker::getIdField()
QueryTrait::prepare in core/modules/workspaces/src/EntityQuery/QueryTrait.php
Tables::addWorkspaceTrackerJoin in core/modules/workspaces/src/EntityQuery/Tables.php
Adds a join to the 'workspace_association' table for an entity base table.
ViewsOperations::ensureWorkspaceAssociationTable in core/modules/workspaces/src/Hook/ViewsOperations.php
Adds the 'workspace_association' table to a views query.
workspaces_update_11302 in core/modules/workspaces/workspaces.install
Populate the 'workspace_association_revision' table.
WorkspaceTracker::doDeleteAssociations in core/modules/workspaces/src/WorkspaceTracker.php
Executes a delete query for workspace associations.

... See full list

File

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

Class

WorkspaceTracker
Provides a class for CRUD operations on workspace associations.

Namespace

Drupal\workspaces

Code

public static function getIdField(string $entity_type_id) : string {
  static $id_field_map = [];
  if (!isset($id_field_map[$entity_type_id])) {
    $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
    $id_field_map[$entity_type_id] = $entity_type->hasIntegerId() ? 'target_entity_id' : 'target_entity_id_string';
  }
  return $id_field_map[$entity_type_id];
}

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