-
Notifications
You must be signed in to change notification settings - Fork 10
Can't return scalar values from RPC services #6
Comments
use ZF\ContentNegotiation\ViewModel; return new ViewModel([0 => 1]); |
This return a object, not a array like expected. return this json I expected this Using a integer:
I receive this error:
This is the projected behavior? |
The error is correct. If your calling process needs a scalar value and cannot process the json you could, and I'm not recommending you do this, put a die(1); at the end of your procedure. |
I guess that a better behavior is if the array is a hashmap use the current top level parser, in another cases use the deep level parser. Is very ugly the current behavior. |
By now I using this solution to not break the flow of the framework.
|
This repository has been closed and moved to laminas-api-tools/api-tools-rpc; a new issue has been opened at laminas-api-tools/api-tools-rpc#3. |
Today I try return a integer from my rpc service and apigility return a html page without a error.
I see that top level parser is different from deep level parser, for example:
this code
return array(array(1));
return this json
{"0":[1]}
Maybe the problem has something relative to this, sometime that top leve parser try convert everthing to a object.
The text was updated successfully, but these errors were encountered: