Closed
Description
Hi,
I'd like to create resource with following relationship my_relation
, which only contains links
property, ie. there is no data
property with resource linkage:
{
"data": {
"type": "...",
"id": "...",
"relationships": {
"my_relation": {
"links": {
"related": "/foo"
}
}
}
}
}
This is allowed as per JSON:API spec:
A “relationship object” MUST contain at least one of the following:
- links: a links object
- data: resource linkage
- meta: a meta object that contains non-standard meta-information about the relationship.
Is there any way how to accomplish this now, with version 2 of the library? It was possible with version 1:
$resourceObject->setRelationship('my_relation', Relationship::fromRelatedLink('/foo'));
However now there seems to be only ToNull
, ToOne
and ToMany
relation, neither of which accomplishes exactly this (eg. ToNull adds data: null
to the relationship).