bluetools/moneybird_php_api — pull request #27 by jelrikvh (2012-10-05 14:28:32+00:00)
Title: Allowing for extension of domain model classes

Due to reliance on get_class() (in ApiConnector.php::getType() and XmlMapper::mapObjectToElementName()) for building the right API request URL and XML tree, subclassing the Invoice, IncomingInvoice, RecurringTemplate etc, but also for example the Invoice_Detail(_Array), classes proved to be error prone.

This commit should fix these issues and allows for the usage of a subclass of one of the domain models, by using a fixed list of possible classes and checking with instanceof, instead of get_class(), which also accounts for superclasses.

It is not yet possible to have the Services return your own subclass objects, and there is still an issue with the _Array classes, which rely on the underscored classname to define which type their child items have to be.