PHP Toolkit 13.1 Upsert Patch
PHP Toolkit 13.1 has a broken implementation of upsert() in SforceEnterpriseClient. The object type is hard coded as 'Contact', and there is no way to specify a different object type. Apply the following patch to fix:
--- phptoolkit-13_1/soapclient/SforceEnterpriseClient.php 2009-09-04 14:38:00.000000000 -0400
+++ phptoolkit-13_1/soapclient/SforceEnterpriseClient.php.new 2010-07-14 00:54:46.000000000 -0400
@@ -83,11 +83,11 @@ class SforceEnterpriseClient extends Sfo
* @param array $sObjects Array of sObjects
* @return UpsertResult
*/
- public function upsert($ext_Id, $sObjects) {
+ public function upsert($ext_Id, $sObjects, $type) {
$arg = new stdClass;
$arg->externalIDFieldName = new SoapVar($ext_Id, XSD_STRING, 'string', 'http://www.w3.org/2001/XMLSchema');
foreach ($sObjects as &$sObject) {
- $sObject = new SoapVar($sObject, SOAP_ENC_OBJECT, 'Contact', $this->namespace);
+ $sObject = new SoapVar($sObject, SOAP_ENC_OBJECT, $type, $this->namespace);
}
$arg->sObjects = $sObjects;
return parent::_upsert($arg);
As a previous wiki editor mentioned, it is not apparent where to submit a patch or report a bug. I decided to simply post a patch.