-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResourceIdentifier does not consider "data" key #16
Comments
👍 |
This type of query is exactly what's supported by the implementation though, //query
{
"data": {
"type": "photos",
"attributes": {
"title": "Ember Hamster",
"src": "http://example.com/images/productivity.png"
},
"relationships": {
"photographer": {
"data": { "type": "people", "id": "9" }
},
"others": {
"data": [
{ "type": "other", "id": "1" },
{ "type": "other", "id": "2" }
]
}
}
}
} //ToOneRelationship hydrator
function($domainObject, $relationship, $data, $relationshipName) {
$resourceIdentifier = $relationship->getResourceIdentifier();
//$resourceIdentifier->getType() is "people"
//$resourceIdentifier->getId() is "9"
...
}
//ToManyRelationship hydrator
function($domainObject, $relationship, $data, $relationshipName) {
foreach ($relationship->getResourceIdentifiers() as $resourceIdentifier) {
//$resourceIdentifier->getType() is "other"
//$resourceIdentifier->getId() is "1", then "2"
...
}
...
} |
I don't get it @dimvic .
|
My fear is that Anyway, thanks for catching this problem! I can fix it right now, but can only assure if it really works in the evening. |
I found another bug with the aformentioned method, so I fixed it. Feel free to reopen the issue if you find it otherwise! |
Hi there,
As JSON API specification says
Correct me if i'm wrong, but ResourceIdentifier does not care about this
data
key.And as we pass complete array in Request it results as
null
.You can try it with this simple example from JSON API documentation:
The text was updated successfully, but these errors were encountered: