Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface::getSelfSubLink PHP Method

    public function getSelfSubLink();

Usage Example

 /**
  * @param ResourceObjectInterface     $parent
  * @param RelationshipObjectInterface $relation
  *
  * @return array
  */
 private function getRelationRepresentation(ResourceObjectInterface $parent, RelationshipObjectInterface $relation)
 {
     // "self" is a reserved keyword and cannot be used as a related resource link name
     $isOk = $relation->getName() !== Document::KEYWORD_SELF;
     $isOk ?: Exceptions::throwInvalidArgument('relation.name', $relation->getName());
     $representation = [];
     if (($meta = $relation->getMeta()) !== null) {
         $representation[Document::KEYWORD_META] = $meta;
     }
     $baseUrl = null;
     if (($selfSubLink = $parent->getSelfSubLink()) !== null) {
         $baseUrl = $selfSubLink->isTreatAsHref() === true ? $selfSubLink->getSubHref() . '/' : $this->document->getUrlPrefix() . $selfSubLink->getSubHref() . '/';
     }
     foreach ($relation->getLinks() as $name => $link) {
         $representation[Document::KEYWORD_LINKS][$name] = $this->getLinkRepresentation($baseUrl, $link);
     }
     return $representation;
 }
All Usage Examples Of Neomerx\JsonApi\Contracts\Schema\ResourceObjectInterface::getSelfSubLink