-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't return scalar values from RPC services #3
Comments
use ZF\ContentNegotiation\ViewModel; return new ViewModel([0 => 1]); Originally posted by @TomHAnderson at zfcampus/zf-rpc#6 (comment) |
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? Originally posted by @edipoReboucas at zfcampus/zf-rpc#6 (comment) |
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. Originally posted by @TomHAnderson at zfcampus/zf-rpc#6 (comment) |
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. Originally posted by @edipoReboucas at zfcampus/zf-rpc#6 (comment) |
By now I using this solution to not break the flow of the framework.
Originally posted by @edipoReboucas at zfcampus/zf-rpc#6 (comment) |
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.
Originally posted by @edipoReboucas at zfcampus/zf-rpc#6
The text was updated successfully, but these errors were encountered: