/** * @inheritdoc */ public function withRelationshipRelatedLink($resource, $relationshipName, $meta = null, $treatAsHref = false) { $parentSubLink = $this->container->getSchema($resource)->getSelfSubLink($resource); $selfHref = $parentSubLink->getSubHref() . '/' . $relationshipName; $links = [DocumentInterface::KEYWORD_RELATED => $this->factory->createLink($selfHref, $meta, $treatAsHref)]; return $this->withLinks($links); }
/** * @param object $resource * @param string $key * @param string $prefix * @param string $name * @param null|mixed $meta * @param bool $treatAsHref * * @return EncoderInterface */ private function getRelationshipLink($resource, $key, $prefix, $name, $meta = null, $treatAsHref = false) { $parentSubLink = $this->container->getSchema($resource)->getSelfSubLink($resource); $selfHref = $parentSubLink->getSubHref() . $prefix . '/' . $name; $links = [$key => $this->factory->createLink($selfHref, $meta, $treatAsHref)]; return $this->withLinks($links); }