Closed specialtactics closed 4 years ago
@specialtactics This change broke our API. We did not anticipate a backwards-breaking change like this in a SEMVER patch release: "Argument 1 passed to GovWorks\Transformers\Facility\FacilityTransformer::transform() must be an instance of GovWorks\Models\Facility, instance of stdClass given, called in \/var\/www\/html\/vendor\/league\/fractal\/src\/Scope.php on line 407"
We had the following implementation. $facilities is a laravel collection of Facility models.
@RoyHP I do apologise that's happened for you, but it's not clear to me why you are using that function in that way.
It does not make sense to pass an array to a transformer which transforms a model.
You should either use response->item, or you should change your transformer to accept Stdclass.
@specialtactics Yeah I'm not saying we're using it correctly, just that it has had this side effect. We will update the implementation to use item. Thank you.
This will pass array responses through the normal transformation and wrap it inside the "data" key