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
Hello I really liked the flexibility of this Soap Client Plugin but I am a PHP developer and I could not figure out why the response returns different result if one or many appear. I searched a lot and found only one correct answer and I fixed it for myself here is the question that other dev asked more explanatory:
response with one:
object(stdClass)#2 (1) {
["return"]=>
object(stdClass)#3 (1) {
["row"]=>`
object(stdClass)#4 (1) {
["pkid"]=>
string(36) "9dbd9b32-8d64-41ad-a355-8f62e050ffce"
}
}
}
with more than one:
object(stdClass)#2 (1) {
["return"]=>
object(stdClass)#3 (1) {
["row"]=>
array(2) {
[0]=>
object(stdClass)#4 (1) {
["pkid"]=>
string(36) "fa0540f7-8e75-481b-a193-7a06d7f601a8"
}
[1]=>
object(stdClass)#5 (1) {
["pkid"]=>
string(36) "fa0c8c7a-79be-4667-ae70-c3e773908b52"
}
}
}
}
and to see why this is a problem:
for one:
foreach ($response->return as $row){
var_dump($row->pkid);
}
for more than one:
foreach ($response->return->row as $row){
var_dump($row->pkid);
}
So after I saw that's my case I simply added the 'features'=>SOAP_SINGLE_ELEMENT_ARRAYS function to the controllers approach in the options:
.....
->options(['login' => 'username', 'password' => 'password', 'features'=>SOAP_SINGLE_ELEMENT_ARRAYS]);
.....
This fixed the problem and now every response no mater if one or many, returns properly.
I think it is really strange that it was hard to find why this was happening and I'm just presenting you this matter to review.
The text was updated successfully, but these errors were encountered:
Hello I really liked the flexibility of this Soap Client Plugin but I am a PHP developer and I could not figure out why the response returns different result if one or many appear. I searched a lot and found only one correct answer and I fixed it for myself here is the question that other dev asked more explanatory:
response with one:
object(stdClass)#2 (1) {
["return"]=>
object(stdClass)#3 (1) {
["row"]=>`
object(stdClass)#4 (1) {
["pkid"]=>
string(36) "9dbd9b32-8d64-41ad-a355-8f62e050ffce"
}
}
}
with more than one:
object(stdClass)#2 (1) {
["return"]=>
object(stdClass)#3 (1) {
["row"]=>
array(2) {
[0]=>
object(stdClass)#4 (1) {
["pkid"]=>
string(36) "fa0540f7-8e75-481b-a193-7a06d7f601a8"
}
[1]=>
object(stdClass)#5 (1) {
["pkid"]=>
string(36) "fa0c8c7a-79be-4667-ae70-c3e773908b52"
}
}
}
}
and to see why this is a problem:
for one:
foreach ($response->return as $row){
var_dump($row->pkid);
}
for more than one:
foreach ($response->return->row as $row){
var_dump($row->pkid);
}
So after I saw that's my case I simply added the 'features'=>SOAP_SINGLE_ELEMENT_ARRAYS function to the controllers approach in the options:
.....
->options(['login' => 'username', 'password' => 'password', 'features'=>SOAP_SINGLE_ELEMENT_ARRAYS]);
.....
This fixed the problem and now every response no mater if one or many, returns properly.
I think it is really strange that it was hard to find why this was happening and I'm just presenting you this matter to review.
The text was updated successfully, but these errors were encountered: