private function getRelationRepresentation(ResourceObjectInterface $parent, RelationshipObjectInterface $relation)
{
$isOk = $relation->getName() !== Document::KEYWORD_SELF;
if ($isOk === false) {
throw new InvalidArgumentException(T::t('\'%s\' is a reserved keyword and cannot be used as a relationship name in type \'%s\'', [Document::KEYWORD_SELF, $parent->getType()]));
}
$representation = [];
if (($meta = $relation->getMeta()) !== null) {
$representation[Document::KEYWORD_META] = $meta;
}
$baseUrl = $this->document->getUrlPrefix();
foreach ($relation->getLinks() as $name => $link) {
$representation[Document::KEYWORD_LINKS][$name] = $this->getLinkRepresentation($baseUrl, $link);
}
return $representation;
}