You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$mappings = array(OfferMapping::class); // Also tried with []$mapper = newMapper($mappings);
$transformer = newJsonApiTransformer($mapper);
$serializer = newJsonApiSerializer($transformer);
returnresponse()->$serializer->serialize(Offer::all())
->header('Access-Control-Allow-Origin', '*');
This error message:
1/1
FatalThrowableError in MappingFactory.php line 93:
Type error: Argument 1 passed to NilPortugues\Api\Mapping\MappingFactory::fromArray() must be of the type array, string given, called in /var/www/vendor/nilportugues/api-transformer/src/Mapping/Mapper.php on line 53
in MappingFactory.php line 93
at MappingFactory::fromArray('App\Api\Mappings\OfferMapping') in Mapper.php line 53
at Mapper->buildMapping('App\Api\Mappings\OfferMapping') in Mapper.php line 36
at Mapper->__construct(array('App\Api\Mappings\OfferMapping')) in OfferController.php line 35
I have tried passing
$mapper = newMapper([1]);
$mapper = new Mapper(array(OfferMapping::class, $othermapping))
And other example values with no result. It seems to internally unbox the first one all the time.
I am using laravel 5.2 and using php-json-api 2.6.0.
The text was updated successfully, but these errors were encountered:
Which means that if you don't realize the class does not exist (was not properly imported) the function thinks it is an array. Would it be possible to throw a different error instead maybe to enhance debugging?
I am constantly getting for this code:
This error message:
I have tried passing
And other example values with no result. It seems to internally unbox the first one all the time.
I am using laravel 5.2 and using php-json-api 2.6.0.
The text was updated successfully, but these errors were encountered: