From bbca822f15e96a4e816686b572def5fedf043b3e Mon Sep 17 00:00:00 2001 From: Marc Michalsky forumZFD Date: Tue, 29 Sep 2020 16:14:49 +0200 Subject: [PATCH] comments --- api/v3/TwingleSync/models/TwingleProject.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/api/v3/TwingleSync/models/TwingleProject.php b/api/v3/TwingleSync/models/TwingleProject.php index f268dd8..e46d29f 100644 --- a/api/v3/TwingleSync/models/TwingleProject.php +++ b/api/v3/TwingleSync/models/TwingleProject.php @@ -179,6 +179,15 @@ class TwingleProject { } } + /** + * Instantiate an existing project by campaign id + * + * @param $id + * + * @return \CRM\TwingleCampaign\Models\TwingleProject + * @throws \CiviCRM_API3_Exception + * @throws \Exception + */ public static function fetch($id) { $result = civicrm_api3('Campaign', 'getsingle', [ 'sequential' => 1, @@ -222,6 +231,7 @@ class TwingleProject { */ private function translateValues($rev = FALSE) { $values = []; + // Translate from field name to custom field name if (!$rev) { foreach (TwingleProject::$customFieldMapping as $field => $custom) { if (array_key_exists( @@ -236,6 +246,7 @@ class TwingleProject { } } } + // Translate from custom field name to field name else { foreach (TwingleProject::$customFieldMapping as $field => $custom) { if (array_key_exists($custom, $this->values) @@ -360,6 +371,4 @@ class TwingleProject { } - - } \ No newline at end of file