Skip to content
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

Empty has_many or many_many relations don't show up in serialized output. #50

Open
bummzack opened this issue Jul 8, 2015 · 1 comment

Comments

@bummzack
Copy link
Contributor

bummzack commented Jul 8, 2015

A populated relation might look like this when serialized:

"myRelation": [1, 5, 6]

If that relation contains no children, the "myRelation" key is entirely missing from the serialized data, but it should be:

"myRelation": []

Might be easily fixed by removing the check on RESTfulAPI_BasicSerializer.php:L209?

bummzack added a commit to bummzack/silverstripe-restfulapi that referenced this issue Jul 17, 2015
Relations with no records should still show up in the serialized data, just as an empty array.
Added tests to check serialization behavior.
@bummzack
Copy link
Contributor Author

A PR for this is up. #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant