code cleanup

This commit is contained in:
Marc Michalsky forumZFD 2021-02-19 16:13:00 +01:00
parent 54fe303465
commit c855b6d083
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
2 changed files with 8 additions and 6 deletions

View file

@ -15,8 +15,6 @@ class CRM_TwingleCampaign_BAO_TwingleCampaign {
private $id; private $id;
private $campaign_type_id;
private $values; private $values;
@ -79,7 +77,7 @@ class CRM_TwingleCampaign_BAO_TwingleCampaign {
* *
* @throws CiviCRM_API3_Exception * @throws CiviCRM_API3_Exception
*/ */
private function fetch() { public function fetch() {
$this->values = civicrm_api3('TwingleCampaign', 'getsingle', $this->values = civicrm_api3('TwingleCampaign', 'getsingle',
['id' => $this->id])['values']; ['id' => $this->id])['values'];
} }
@ -103,6 +101,11 @@ class CRM_TwingleCampaign_BAO_TwingleCampaign {
// Determine the parent project id by looping through the campaign tree // Determine the parent project id by looping through the campaign tree
// until the parent campaign type is a TwingleProject // until the parent campaign type is a TwingleProject
$parent_id = $this->values['parent_id']; $parent_id = $this->values['parent_id'];
$parent_id = $parent_id ?? civicrm_api3(
'TwingleCampaign',
'getsingle',
['id' => $this->id]
)['values']['parent_id'];
$parent_campaign_type_id = NULL; $parent_campaign_type_id = NULL;
@ -288,8 +291,7 @@ class CRM_TwingleCampaign_BAO_TwingleCampaign {
* ## Delete TwingleCampaign * ## Delete TwingleCampaign
* Deletes this TwingleCampaign from CiviCRM * Deletes this TwingleCampaign from CiviCRM
*/ */
private public function delete() {
function delete() {
if ($this->id) { if ($this->id) {
try { try {
civicrm_api3('Campaign', 'delete', ['id' => $this->id]); civicrm_api3('Campaign', 'delete', ['id' => $this->id]);

View file

@ -7,7 +7,7 @@ use CRM_TwingleCampaign_ExtensionUtil as E;
/** /**
* A singleton that caches mappings and settings * A singleton that caches mappings and settings
* *
* @package CRM\TwingleCampaign\Utilities * @package CRM\TwingleCampaign\Utils
*/ */
class CRM_TwingleCampaign_Utils_ExtensionCache { class CRM_TwingleCampaign_Utils_ExtensionCache {