From e71ab9d769b1fff4230031b96933b396aac91924 Mon Sep 17 00:00:00 2001 From: Martin Butt Date: Mon, 23 Mar 2015 08:17:09 -0700 Subject: [PATCH] Chunk large delete requests --- soapclient/SforceBaseClient.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/soapclient/SforceBaseClient.php b/soapclient/SforceBaseClient.php index 3b494c7..0b98c65 100644 --- a/soapclient/SforceBaseClient.php +++ b/soapclient/SforceBaseClient.php @@ -578,9 +578,19 @@ public function convertLead($leadConverts) { */ public function delete($ids) { $this->setHeaders("delete"); - $arg = new stdClass(); - $arg->ids = $ids; - return $this->sforce->delete($arg)->result; + if(count($ids) > 200) { + $chunked_ids = array_chunk($ids, 200); + foreach($chunked_ids as $cids) { + $arg = new stdClass; + $arg->ids = $cids; + $result = $this->sforce->delete($arg)->result; + } + } else { + $arg = new stdClass; + $arg->ids = $ids; + $result = $this->sforce->delete($arg)->result; + } + return $result; } /**