ddeboer/DdeboerSalesforceMapperBundle — pull request #8 by timo-p (2012-03-02 10:14:37+00:00)
Title: Changes to the way Mapper::Save() works

I've made some changes to how saving works in mapper bundle. The reason for this change is to better handle cases where user is saving multiple models at once and Salesforce fails to save one or more of the models.

The changes:
* AbstractModel has two new properties success and errors, which are the values returned by Salesforce for each saved object.
* Client has a new property resultCheckDisabled which determines whether checkResult is called in doCall.
* Mapper has a new method disableClientResultCheck() whichs disables client's result check using the new property. This method is added to services.xml so that the check is automatically disabled.
* Mapper has a new exception SaveException, which extends \Extension and it contains properties okModels and errorModels and getters and setters for both. The idea is that when SaveException is thrown the okModels and errorModels are populated by the models which were saved succesfully and with those which had problems while saving.
* Mapper has a new method checkResult which loops through the saved models and if one of the models has success=false then it throws a SaveException.
* In Mapper::save() the values of models' success and errors properties are setted the same way as id is setted after saving a new model. Success and errors values are setted in both update and create cases.
* Instead of the client bundle throwing an exception if saving one of the given models fails, the results are checked in Mapper::save() by calling checkResult() which throws SaveException if one of the models has success=false.
* The user can catch the SaveException and then get the okModels and errorModels to better handle cases when something goes wrong in bulk save.