function WorkspaceAssociation::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.
7 calls to WorkspaceAssociation::getIdField()
- QueryTrait::prepare in core/
modules/ workspaces/ src/ EntityQuery/ QueryTrait.php - Tables::addWorkspaceAssociationJoin in core/
modules/ workspaces/ src/ EntityQuery/ Tables.php - Adds a new join to the 'workspace_association' table for an entity base table.
- ViewsQueryAlter::ensureWorkspaceAssociationTable in core/
modules/ workspaces/ src/ ViewsQueryAlter.php - Adds the 'workspace_association' table to a views query.
- WorkspaceAssociation::deleteAssociations in core/
modules/ workspaces/ src/ WorkspaceAssociation.php - WorkspaceAssociation::getEntityTrackingWorkspaceIds in core/
modules/ workspaces/ src/ WorkspaceAssociation.php
File
-
core/
modules/ workspaces/ src/ WorkspaceAssociation.php, line 440
Class
- WorkspaceAssociation
- Provides a class for CRUD operations on workspace associations.
Namespace
Drupal\workspacesCode
public static function getIdField(string $entity_type_id) : string {
static $id_field_map = [];
if (!isset($id_field_map[$entity_type_id])) {
$id_field = \Drupal::entityTypeManager()->getDefinition($entity_type_id)
->getKey('id');
$field_map = \Drupal::service('entity_field.manager')->getFieldMap()[$entity_type_id];
$id_field_map[$entity_type_id] = $field_map[$id_field]['type'] !== 'integer' ? 'target_entity_id_string' : 'target_entity_id';
}
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.