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

Commit 14eadd0

Browse files
author
Pat Patterson
committed
Merge branch 'martinkiva-master'
Allow deletion of more than 200 records in a single delete() call
2 parents 234c913 + 53025b4 commit 14eadd0

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

soapclient/SforceBaseClient.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,20 @@ public function convertLead($leadConverts) {
578578
*/
579579
public function delete($ids) {
580580
$this->setHeaders("delete");
581-
$arg = new stdClass();
582-
$arg->ids = $ids;
583-
return $this->sforce->delete($arg)->result;
581+
if(count($ids) > 200) {
582+
$result = array();
583+
$chunked_ids = array_chunk($ids, 200);
584+
foreach($chunked_ids as $cids) {
585+
$arg = new stdClass;
586+
$arg->ids = $cids;
587+
$result = array_merge($result, $this->sforce->delete($arg)->result);
588+
}
589+
} else {
590+
$arg = new stdClass;
591+
$arg->ids = $ids;
592+
$result = $this->sforce->delete($arg)->result;
593+
}
594+
return $result;
584595
}
585596

586597
/**

0 commit comments

Comments
 (0)