Closed albertixcom closed 4 years ago
Hi I've try to make my own cache of products list using json, so I've made this:
/*@var $items Types\ItemType[] */ $items = $trading->getMyeBaySellingItems(); foreach($items As $item) { $string = json_encode($item->toArray(), JSON_PRETTY_PRINT); $arr = json_decode($string, true); //---- GOT ERROR: // Types\BaseType private on // function set($class, $name, $value) // self::ensurePropertyType($class, $name, $value); $testItem = new Types\ItemType($arr); }
This error is because: Array ( [BuyItNowPrice] => Array ( [value] => 179 // Value in json is Integer, expected double
Temporary solution:
// self::ensurePropertyType($class, $name, $value);
I suggest to create adjust "toArray" function with vars like this: 179.0 so interpreted recognize it like double and not integer
Sorry for my horrible english. Alberto
Hi I've try to make my own cache of products list using json, so I've made this:
This error is because: Array ( [BuyItNowPrice] => Array ( [value] => 179 // Value in json is Integer, expected double
Temporary solution:
// self::ensurePropertyType($class, $name, $value);
I suggest to create adjust "toArray" function with vars like this: 179.0 so interpreted recognize it like double and not integer
Sorry for my horrible english. Alberto