Skip to content

Commit

Permalink
Merge pull request #63 from kmccormick/master
Browse files Browse the repository at this point in the history
add bulkDelete function
  • Loading branch information
reynolek authored Mar 23, 2017
2 parents 04e80b1 + d97cc31 commit 2d05b58
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,23 @@ public function delete(AutotaskObjects\Entity $obj)
return $this->_call('delete', array($params));
}

public function bulkDelete(array $objs)
{
if (count($objs) > 200) {
throw new \Exception('You can only execute a bulk delete on a max of 200 objects per request');
}
$deleteObjs = null;
$calls = array();
foreach ($objs as $obj) {
if (!$deleteObjs) {
$deleteObjs = new AutotaskObjects\DeleteParam($obj);
} else {
$deleteObjs->Entities[] = $obj;
}
}
return $this->_call('delete', array($deleteObjs));
}

public function CreateAttachment(AutotaskObjects\Entity $obj)
{
$params = new AutotaskObjects\CreateAttachment($obj);
Expand Down

0 comments on commit 2d05b58

Please sign in to comment.