If the "salutation" field is not added to $contact_variables, it gets set to a default empty string "". The Teamleader API returns an error indicating the salutation cannot be empty. If the salutation would not be in the posted body to Teamleader at all, there would be no problem (since it's an optional field).
In \Nascom\TeamleaderApiClient\Request\Contact\ContactsAddRequest I'm getting PHP errors in the constructor, e.g. in $this->setAddresses($contact->getAddresses()); Without values for addresses in $contact_variables, $contact->getAddresses() returns value null. However $this->setAddresses() expects an array object (via type hinting), not a null value.
This PR fixes this behaviour, allowing me to add contacts to Teamleader that only contain a few basic fields.
When adding a contact through v2 of this Teamleader API library, I'm getting errors when only a few variables are provided.
Example use case:
Problems:
$this->setAddresses($contact->getAddresses());
Without values for addresses in $contact_variables, $contact->getAddresses() returns value null. However $this->setAddresses() expects an array object (via type hinting), not a null value.This PR fixes this behaviour, allowing me to add contacts to Teamleader that only contain a few basic fields.