From 0053ecc30f3259acf85f7315f86ea7787cd81744 Mon Sep 17 00:00:00 2001 From: Marc Michalsky forumZFD Date: Wed, 7 Oct 2020 15:16:23 +0200 Subject: [PATCH] get project options via API call --- api/v3/TwingleSync/BAO/TwingleApiCall.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/api/v3/TwingleSync/BAO/TwingleApiCall.php b/api/v3/TwingleSync/BAO/TwingleApiCall.php index b7595a1..06eb9b0 100644 --- a/api/v3/TwingleSync/BAO/TwingleApiCall.php +++ b/api/v3/TwingleSync/BAO/TwingleApiCall.php @@ -69,6 +69,18 @@ class TwingleApiCall { return $response; } + + public function getProjectOptions(int $projectId) { + $response = []; + foreach ($this->organisationId as $organisationId) { + $url = $this->protocol . 'project' . $this->baseUrl . $projectId . + '/options'; + + $response = array_merge($this->curlGet($url)); + } + return $response; + } + /** * * Returns all Events for the given $projectId @@ -122,7 +134,15 @@ class TwingleApiCall { // If $values is an array if (is_array($values)) { - $project = new TwingleProject($values, TwingleProject::TWINGLE); + // Get project options + $project_options = $this->getProjectOptions($values['id']); + + // Instantiate TwingleProject + $project = new TwingleProject( + $values, + $project_options, + TwingleProject::TWINGLE + ); // Check if the TwingleProject campaign already exists if (!$project->exists()) {