php-src
php-src copied to clipboard
add creating object constructor from Jason
Description
add this signature and syntax to PHP core to enjoy developer from fast developing
class MyObject{
__json_constructor( {"AdditionAmount": 0 // default value,
"CashRegisterDeviceRef": null,
"CustomerAddressRef": null,
"DeliveryDesc": "",
"Description": null,
"DeviceReceiptCode": null,
"DocumentRef": 0,
"EffectiveNetPrice": 11678899,
"ExcludedPolicies": "",
"Fee": 11678899.000000,
"FreeProductBusinessPolicyConditionRowRef": null,
"FreeProductBusinessPolicyRef": null,
"HasReservation": false,
})
}
//create new that instance :
$obj= new MyObject({"AdditionAmount": 0,
"CashRegisterDeviceRef": null,
"CustomerAddressRef": null,
"DeliveryDesc": "",
"Description": null,
"DeviceReceiptCode": null,
"DocumentRef": 0,
"EffectiveNetPrice": 11678899,
"ExcludedPolicies": "",
"Fee": 11678899.000000,
"FreeProductBusinessPolicyConditionRowRef": null,
"FreeProductBusinessPolicyRef": null,
"HasReservation": false,
})
How is that supposed to work? Are all JSON properties to be checked; are superfluous properties to be ignored, or error? What about properties with object values (potentially again having properties with object values, and so on).
This certainly needs more thought and discussion, and finally the RFC process. Feel free to pursue this process.
i just tell problem and idea and solution details of that should be in implementing time not by me you can make it a RFC but i am bussy to make it if you do it php lang will be more popular thanks