This repository has been archived by the owner on Jun 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 343
Improve serialization #1
Labels
Comments
Implemented in d8457f4 |
stiivo
added a commit
to stiivo/ebay-sdk-php
that referenced
this issue
Apr 28, 2017
```php <?php use DTS\eBaySDK\Fulfillment\Types; use DTS\eBaySDK\Fulfillment\Services; use DTS\eBaySDK\Fulfillment\Types\GetOrdersRestRequest; require_once __DIR__.'/vendor/autoload.php'; $token = "token"; $service = new Services\FulfillmentService([ 'authorization' => $token ]); $request = new GetOrdersRestRequest(); $request->filter = "creationdate:[2017-04-27T08:25:43.511Z..]"; $response = $service->getOrders($request); file_put_contents("test.json", json_encode($response->toArray(), JSON_PRETTY_PRINT)); ``` brought me this: PHP Fatal error: Uncaught DTS\eBaySDK\Exceptions\UnknownPropertyException: Unknown property discountAmount in /home/steven/Schreibtisch/eBayTrackingNumber/vendor/dts/ebay-sdk-php/src/Types/BaseType.php:464 Stack trace: #0 /home/steven/Schreibtisch/eBayTrackingNumber/vendor/dts/ebay-sdk-php/src/Types/BaseType.php(309): DTS\eBaySDK\Types\BaseType::ensurePropertyExists('DTS\\eBaySDK\\Typ...', 'discountAmount') davidtsadler#1 /home/steven/Schreibtisch/eBayTrackingNumber/vendor/dts/ebay-sdk-php/src/Types/BaseType.php(276): DTS\eBaySDK\Types\BaseType->set('DTS\\eBaySDK\\Typ...', 'discountAmount', Array) davidtsadler#2 /home/steven/Schreibtisch/eBayTrackingNumber/vendor/dts/ebay-sdk-php/src/Types/BaseType.php(62): DTS\eBaySDK\Types\BaseType->setValues('DTS\\eBaySDK\\Typ...', Array) davidtsadler#3 /home/steven/Schreibtisch/eBayTrackingNumber/vendor/dts/ebay-sdk-php/src/Fulfillment/Types/DeliveryCost.php(58): DTS\eBaySDK\Types\BaseType->__construct(Array) davidtsadler#4 /home/steven/Schreibtisch/eBayTrackingNumber/vendor/dts/ebay-sdk-php/src/Types/BaseType.php(676): DTS\eBaySDK\Ful in /home/steven/Schreibtisch/eBayTrackingNumber/vendor/dts/ebay-sdk-php/src/Types/BaseType.php on line 464 adding the discountAmount property manually made it work for me.
Closed
How do you convert
Can anyone help please? |
It's what becomes of the array as i typecast it from response object.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Look at improving the serialization of the SDK.
One possible solution is for the SDK to implement the Serializable interface
Another solution is to improve the passing of property values via the constructor. At the moment it is possible to do the following.
However the above method involves constructing objects before passing them via the array. An improvement would be to also allow the following.
This solution could allow the usage shown below when calling the toArray method.
The text was updated successfully, but these errors were encountered: