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

Commit e71ab9d

Browse files
author
Martin Butt
committed
Chunk large delete requests
1 parent 234c913 commit e71ab9d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

soapclient/SforceBaseClient.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,19 @@ 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+
$chunked_ids = array_chunk($ids, 200);
583+
foreach($chunked_ids as $cids) {
584+
$arg = new stdClass;
585+
$arg->ids = $cids;
586+
$result = $this->sforce->delete($arg)->result;
587+
}
588+
} else {
589+
$arg = new stdClass;
590+
$arg->ids = $ids;
591+
$result = $this->sforce->delete($arg)->result;
592+
}
593+
return $result;
584594
}
585595

586596
/**

0 commit comments

Comments
 (0)