colymba/silverstripe-restfulapi

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

Opened this issue · 1 comments

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?

A PR for this is up. #54