You are here

protected function FieldResolver::constructInternalPath in JSON:API 8

Same name and namespace in other branches
  1. 8.2 src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::constructInternalPath()

Expands the internal path with the "entity" keyword.

Parameters

string[] $references: The resolved internal field names of all entity references.

string[] $property_path: (optional) A sub-property path for the last field in the path.

Return value

string The expanded and imploded path.

1 call to FieldResolver::constructInternalPath()
FieldResolver::resolveInternalEntityQueryPath in src/Context/FieldResolver.php
Resolves external field expressions into entity query compatible paths.

File

src/Context/FieldResolver.php, line 374

Class

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

Namespace

Drupal\jsonapi\Context

Code

protected function constructInternalPath(array $references, array $property_path = []) {

  // Reconstruct the path parts that are referencing sub-properties.
  $field_path = implode('.', $property_path);

  // This rebuilds the path from the real, internal field names that have
  // been traversed so far. It joins them with the "entity" keyword as
  // required by the entity query system.
  $entity_path = implode('.', $references);

  // Reconstruct the full path to the final reference field.
  return empty($field_path) ? $entity_path : $entity_path . '.' . $field_path;
}