- Issue created by @fernly
The Contact::jsonSerialize() method converts the Contact object into an array. But it doesn't include all properties and it doesn't include empty fields which should be reflected in json as well.
The jsonSerialize is currently used to create an array with parts of a Contact so it can be submitted to the Flexmail API to update (replace) a contact. The latter only accepts a full contact object during an update (replace via PUT) call. Side note: there is also a partly update (PATCH) api call which isn't implemented in this module.
Other issues with Contact:
The constructor accepts a source as int or null, but the source property is defined as int only.
A contact object has several fields that can never be empty, which is currently allowed:
Implement a correct Contact::jsonSerialize() returning all properties, also empty ones.
If the jsonSerialize isn't useful anymore after this change, we can add a Contact::toArray() method which the API manager can use to convert a Contact object to an array and eliminate the disallowed Contact fields during an updateContact API call.
Revise the Contact class and FlexmailApiManager:
None.
FlexmailApiManager::updateContact() will accept a full Contact object and process it according to the call it's making.
None.
Active
2.0
Code