The JSON API spec requires that requests for a single record are returned as an object. Alternately, requests for collections, even if the collection only contains a single records, should be returned as an array.
Unfortunately, there isn't a great way to detect whether data coming into the plugin needs to call fetch or fetchAll depending on whether the user is requesting a single record or collection. I tried a few hacky things looking at Model#attributes and the Model#query._statements, but alas I broke it a few times.
Need a better way to determine this. May just revert to a flag that should be passed to the method.
The JSON API spec requires that requests for a single record are returned as an object. Alternately, requests for collections, even if the collection only contains a single records, should be returned as an array.
Unfortunately, there isn't a great way to detect whether data coming into the plugin needs to call
fetchorfetchAlldepending on whether the user is requesting a single record or collection. I tried a few hacky things looking atModel#attributesand theModel#query._statements, but alas I broke it a few times.Need a better way to determine this. May just revert to a flag that should be passed to the method.