src/Resource.php
protected function buildRelationships()
    {
        if (isset($this->relationships)) {
            return $this->relationships;
        }

        $paths = Util::parseRelationshipPaths($this->includes);

        $relationships = [];

        foreach ($paths as $name => $nested) {
            $relationship = $this->serializer->getRelationship($this->data, $name);

            if ($relationship) {
                $relationshipData = $relationship->getData();
                if ($relationshipData instanceof ElementInterface) {
                    $relationshipData->with($nested)->fields($this->fields);
                }

                $relationships[$name] = $relationship;
            }
        }

        return $this->relationships = $relationships;
    }
protected function buildRelationships()
    {
        if (isset($this->relationships)) {
            return $this->relationships;
        }

        $paths = Util::parseRelationshipPaths($this->includes);

        $relationships = [];

        foreach ($paths as $name => $nested) {
            $relationship = $this->serializer->getRelationship($this->data, $name);

            if ($relationship) {
                $relationshipData = $relationship->getData();
                if ($relationshipData instanceof ElementInterface) {
                    $relationshipData->with($nested)->fields($this->fields);
                }

                $relationships[$name] = $relationship;
            }
        }

        return $this->relationships = $relationships;
    }
protected function buildRelationships ( ) { if ( isset ( $ this -> relationships ) ) { return $ this -> relationships ; } $ paths = Util :: parseRelationshipPaths ( $ this -> includes ) ; $ relationships = [ ] ; foreach ( $ paths as $ name => $ nested ) { $ relationship = $ this -> serializer -> getRelationship ( $ this -> data , $ name ) ; if ( $ relationship ) { $ relationshipData = $ relationship -> getData ( ) ; if ( $ relationshipData instanceof ElementInterface ) { $ relationshipData -> with ( $ nested ) -> fields ( $ this -> fields ) ; } $ relationships [ $ name ] = $ relationship ; } } return $ this -> relationships = $ relationships ; }
Get an array of built relationships.

@return \Tobscure\JsonApi\Relationship[]
Get an array of built relationships .