Skip to content

Parsing relationship links #57

@geoffroycochard

Description

@geoffroycochard

Excepted this specification relationship links could be an object like https://jsonapi.org/format/1.0/#document-links and so respect this schema

    "relationships": {
      "vid": {
        "data": {
          "type": "taxonomy_vocabulary--taxonomy_vocabulary",
          "id": "e0b18172-b9fa-4a2f-88c0-ed19dca65a1b"
        },
        "links": {
          "self": {
            "href": "*/jsonapi/taxonomy_term/district/3fa7e3cd-ce96-4be7-abac-7203bf8a9f4f/relationships/vid"
          },
          "related": {
            "href": "*/jsonapi/taxonomy_term/district/3fa7e3cd-ce96-4be7-abac-7203bf8a9f4f/vid"
          }
        }
      },

My patch in RelationshipLink class line 97

        if (array_key_exists('self', $links)) {
            if (! is_string($links['self']) and ! is_object($links['self'])) {
                throw new ValidationException('property "self" has to be a string or object, "' . gettype($links['self']) . '" given.');
            }

            $this->setLink('self', $links['self']);

            unset($links['self']);
        }

but i don't see all consequences ...

Originally posted by @geoffroycochard in #22 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions