-
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
Missing data in response if using omitDataWhenNotIncluded #103
Comments
Hi @Art4 Hmm, yes, it seems like an issue indeed, thanks for bringing it up! Are you up for providing a PR or would you prefer if I did so? |
I tried to create a PR but I struggled at finding a solution. If you know how this can be fixed I would prefer you create a PR. |
I think I know what should be changed. :) I'll have a look. |
I've added 6a4284b - please test if it works for you (p.s. I accidentally added the release date, it's not yet done) |
Thank you very much. I hope I will get the time to test it this weekend. |
I've released 4.3.0 in the meanwhile, but please come back to me should you find any issues with the implementation. |
I've tested this issue with 4.3.0 and can confirm that this bug is fixed. Thank you very much. 👍 |
I have found a potential bug with omitDataWhenNotIncluded and relationships.
In the examples there is a UserResource, see https://github.com/woohoolabs/yin/blob/4.2.1/examples/User/JsonApi/Resource/UserResource.php#L120
The user resource has a contacts relationship that data is set with
setDataAsCallable()
andomitDataWhenNotIncluded()
.If I call the example url
/users/1/relationships/contacts
I get a response without any data. Only the links are there:If i remove the call of
->omitDataWhenNotIncluded()
I get the correct response:I think
omitDataWhenNotIncluded
should be ignored if we want to respond with the relationship.The text was updated successfully, but these errors were encountered: