implement TwingleProject.delete api

This commit is contained in:
Marc Michalsky forumZFD 2021-02-02 20:23:58 +01:00
parent d7930660f3
commit aef7e71e33
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
3 changed files with 213 additions and 17 deletions

View file

@ -214,6 +214,26 @@ abstract class CRM_TwingleCampaign_BAO_Campaign {
}
/**
* ## Delete Campaign
* Deletes this Campaign from CiviCRM
*
* @throws CiviCRM_API3_Exception
*/
public function delete(): bool {
// Delete campaign via Campaign.delete api
if ($this->getId()) {
$result = civicrm_api3('Campaign', 'delete',
['id' => $this->getId()]);
}
else {
throw new CiviCRM_API3_Exception($this->className . ' not found');
}
return ($result['is_error'] == 0);
}
/**
* ## Deactivate this campaign
*