function RelationLinkManager::getRelations

Same name in other branches
  1. 8.9.x 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:' . $this->getLinkDomain($context);
    $cache = $this->cache
        ->get($cid);
    if (!$cache) {
        $data = $this->writeCache($context);
    }
    else {
        $data = $cache->data;
    }
    return $data;
}

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