Closed timint closed 3 years ago
Setting the data type via (array)
will only affect the first element. SveaSoapArrayBuilder->object_to_array()
is recursive, making child objects into arrays as well.
Oh, in that case here is a one liner for you:
$params = json_decode(json_encode($order), true);
<?php
$obj = new StdClass();
$obj->foo = 'bar';
$obj->obj = new StdClass();
$obj->obj->foo = 'bar';
var_dump(json_decode(json_encode($obj), true));
Outputs:
array(2) {
["foo"]=>
string(3) "bar"
["obj"]=>
array(1) {
["foo"]=>
string(3) "bar"
}
}
No need to reinvent the wheel ;b