Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Merge branch 'martinkiva-master'
Browse files Browse the repository at this point in the history
Allow deletion of more than 200 records in a single delete() call
  • Loading branch information
Pat Patterson committed Mar 23, 2015
2 parents 234c913 + 53025b4 commit 14eadd0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions soapclient/SforceBaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,20 @@ 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) {
$result = array();
$chunked_ids = array_chunk($ids, 200);
foreach($chunked_ids as $cids) {
$arg = new stdClass;
$arg->ids = $cids;
$result = array_merge($result, $this->sforce->delete($arg)->result);
}
} else {
$arg = new stdClass;
$arg->ids = $ids;
$result = $this->sforce->delete($arg)->result;
}
return $result;
}

/**
Expand Down

0 comments on commit 14eadd0

Please sign in to comment.