function FieldResolver::getIdFieldName

Same name in other branches
  1. 8.9.x core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::getIdFieldName()
  2. 10 core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::getIdFieldName()
  3. 11.x core/modules/jsonapi/src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::getIdFieldName()

Resolves the UUID field name for a resource type.

Parameters

\Drupal\jsonapi\ResourceType\ResourceType $resource_type: The resource type for which to get the UUID field name.

Return value

string The resolved internal name.

1 call to FieldResolver::getIdFieldName()
FieldResolver::getInternalName in core/modules/jsonapi/src/Context/FieldResolver.php
Resolves the internal field name based on a collection of resource types.

File

core/modules/jsonapi/src/Context/FieldResolver.php, line 512

Class

FieldResolver
A service that evaluates external path expressions against Drupal fields.

Namespace

Drupal\jsonapi\Context

Code

protected function getIdFieldName(ResourceType $resource_type) {
    $entity_type = $this->entityTypeManager
        ->getDefinition($resource_type->getEntityTypeId());
    return $entity_type->getKey('uuid');
}

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