Releases: rmuit/PracticalAfas
Releases · rmuit/PracticalAfas
Fix a constant
Reported by @Huntelaer: constant OP_NOT_ENDS_WITH was incorrect.
2.2
UpdateObject finished
This concludes all I was planning for UpdateObject functionality & unit tests.
New features:
- Support skip=-1 argument for Get connectors.
- recognize a json-output-like structure as valid input to UpdateObject::create().
- There is a static UpdateObject::overrideFieldProperty() method to more easily set e.g. your own aliases.
- Other methods added: Connection: getDataFormat(); UpdateObject: getClassMap(), getPropertyDefinitionOverrides(), unoverrideFieldProperty(), resetPropertyDefinitions().
- Add property definitions for more object types. Thanks to @MegaChriz & Michiel/Intermix.
- Property definitions can specify 'today' as default for date fields.
- Extended docs.
Fixes:
- SoapAppClient did recognize TLS 1.2 properly.
- 'required' objects were also required on update, not only insert.
- More minor fixes re. required/default properties combined with null values.
Minor incompatibilities:
- Helper::IsTemporaryError() is renamed to isTemporaryError().
- Embedded objects cannot be output() by themselves anymore; this will throw an exception. See the 4th argument to getObject() to work around this.
- Standard alias for KnSalesRelationPer.ColA has been renamed from 'verzamelrekening_debiteur' to 'coll_account' and; FbSales.DbId has been renamed from 'sales_relation' to 'debtor_id'.
- UpdateObject::setPropertyDefinitions() (protected method) is deprecated and will be removed at some point. Use resetPropertyDefinitions().
- Connection::sendData() 1st/2nd argument are switched, because the first was not always needed. The old order of arguments is still recognized for now.
Clients cleaned up; proper subsystem for sending data added.
Changes:
- New URL for the AFAS endpoints; clients force TLS 1.2 (as AFAS says they do on their new endpoints).
- Client classes have moved from \PracticalAfas to \PracticalAfas\Client namespace.
- Constructor arguments for the two (usable) clients have changed: the 'options' argument has been split into options for the Client class, and options for the actual HTTP/SOAP connection library. Most people are not affected, but doublecheck your constructors' arguments.
- Added some helper code for code using this library that wants to use data from the last call in their error logging; see src/Client/RememberCallDataTrait.php and src/Helper.php.
- Clients have a getClientType() method; this is now a requirement to be usable with the Connection class / RememberCallDataTrait.
And the big functionality addition (or, 'improvement'... but I more or less assume that noone was using my code for sending data yet):
- All functions related to sending data have been removed from the Helper class and rewritten to \PracticalAfas\UpdateConnector\UpdateObject and child classes. I am confident this will be useful code. (README with examples is not done yet, but the UpdateObject class itself is well documented.)
- Connection::sendData() has different arguments; the deprecated Connection::sendXml() has been removed.
- Changes have been made to the object type definitions that used to be in Helper::objectTypeInfo(), so in the (unlikely) event that someone was using the update code with my own data definitions: not only will the code need to be redone but all data (definitions) will need to be doublechecked. What comes to mind:
-
- '#id' property is now '@id'.
-
- Data type 'long' has changed to 'integer' (in case you have your own custom definitions).
-
- 'default!' does not exist anymore. It meant more or less "set default values on update" but the implementation of this concept had flaws. Every field which did this, now has custom code in UpdateObject child classes taking care of things.
- Methods in the helper class like formatting addresses, validating phone numbers, converting ISO country codes... have been moved into the appropriate UpdateObject child classes. They are public methods so they can still be used independently of the UpdateObject main functionality.
More work on UpdateConnectors over REST
- Enabled Helper::normalizeDataToSend() to send in updates containing multiple elements, using the structure reported in issue #2.
- Redid constuctXml() to reuse normalizeDataToSend(), so the logic to construct update payloads is deduplicated. In the process:
- Tested my years-old code for sending in XML with embedded person-inside-contact-inside-organisation objectst; verified that the payload is still the same.
- Discovered bugs and inconsistencies in those specific update payloads; documented them. (Haven't changed them yet; changes will be in a future 'incompatible' release.)
- Extensively documented reasoning behind those updates & the code comments.
- Extended arguments list of normalizeDataToSend() in an incompatible way. (This should not matter for 'regular' callers because they should not have been passing the $parent_type argument.)
Update Connectors over REST
Most important additions:
- Made REST work with Update Connectors; added a Connection::sendData() for this.
- Added Helper::normalizeDataToSend() which can take as input (mostly) the same arrays as Helper::constructXML() does. Its output can be used in Connection::sendData(), which means that update functionality is also (mostly) 'portable' between SOAP and REST clients, when using these arrays as input. Not all updates work yet / are tested well, though; see README.md#Bugs.
- Now recognizing parameter for 'ordering' results of SOAP Get Connectors. (I didn't know this existed before.) Connection::getData() now recognizes/uses the 'OrderByFieldIds' argument (which is native to REST calls) also with SOAP clients. (SOAP calls' own 'Index' option now works through Connection::getData() calls too, but it is not recommended to use this because of its fairly obscure syntax.)
- Added Helper::getDataBatch() to assist in fetching multi-batch data sets.
REST added for GetConnectors
- Added RestCurlClient; changed Connection to support REST API too.
- Created setters/getters for the 3 'options' argument that SOAP GetConnectors used. The Connection class also supports most of these options when using it with a REST client, but now they don't need to be passed on every call.
- Bugfixes to Connection::parseFilters(), plus minor incompatible change.