Closed raju-cimpress closed 2 years ago
Ui. Nice catch.
I just looked up and saw that the optional flag wasn't used anywhere. So I think it would make more sense to declare fields optional by default. And mark required fields not optional.
Yes, even that would help
I just tagged a v2.17.1-beta.2 with the change.
In order to be correct we will have to mark all required fields which could take some time.
Was now going to mark the fields as optional as it will not introduce a behavioral change and there were less files to be changed 😄 . The flag is now also automatically checked against the RAML specificiation to be there.
Please see https://github.com/commercetools/commercetools-php-sdk/pull/705
I released version 2.18.0 which has the correct set optional flags
Describe the bug fieldDefinitions() function for most of the resource object is missing self::OPTIONAL => true, due to which calling unsetting any value gives error.
To Reproduce Create an object of Address or Customer class and try to call a function to unset an option field. Example for Address object $address try $address->setCompany() i.e, parameter passed to the function. It throws error argument one is expected as string null passed.
Expected behavior $address->setCompany() should work without passing any parameter.
Screenshots/Code snippet As per the documentation https://docs.commercetools.com/api/types#address, Address class should be.
Stack information (please complete the following information):
Additional context Please implement the same for other classes too.