You are here

protected function RelationLinkManager::getRelations in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/hal/src/LinkManager/RelationLinkManager.php \Drupal\hal\LinkManager\RelationLinkManager::getRelations()

Get the array of relation links.

Any field can be handled as a relation simply by changing how it is normalized. Therefore, there is no prior knowledge that can be used here to determine which fields to assign relation URIs. Instead, each field, even primitives, are given a relation URI. It is up to the caller to determine which URIs to use.

Parameters

array $context: Context from the normalizer/serializer operation.

Return value

array An array of typed data IDs keyed by corresponding relation URI. The keys are:

  • 'entity_type_id'
  • 'bundle'
  • 'field_name'

The values for 'entity_type_id', 'bundle' and 'field_name' are strings.

See also

https://www.drupal.org/node/2877608

1 call to RelationLinkManager::getRelations()
RelationLinkManager::getRelationInternalIds in core/modules/hal/src/LinkManager/RelationLinkManager.php
Translates a REST URI into internal IDs.

File

core/modules/hal/src/LinkManager/RelationLinkManager.php, line 131

Class

RelationLinkManager

Namespace

Drupal\hal\LinkManager

Code

protected function getRelations($context = []) {
  $cid = 'hal:links:relations';
  $cache = $this->cache
    ->get($cid);
  if (!$cache) {
    $data = $this
      ->writeCache($context);
  }
  else {
    $data = $cache->data;
  }
  return $data;
}