You are here

public function RelationshipItem::getValue in JSON:API 8

Gets the relationship value.

Defaults to the entity ID.

Return value

string The value of this relationship item.

File

src/Normalizer/RelationshipItem.php, line 117

Class

RelationshipItem
Value object representing a JSON API relationship item.

Namespace

Drupal\jsonapi\Normalizer

Code

public function getValue() {
  $target_uuid = $this->targetEntity === NULL ? 'virtual' : $this
    ->getTargetEntity()
    ->uuid();
  return [
    'target_uuid' => $target_uuid,
    'meta' => $this->metadata,
  ];
}