diff --git a/api/v3/TwingleEvent/Get.php b/api/v3/TwingleEvent/Get.php index 38ac1f1..7ebf0c7 100644 --- a/api/v3/TwingleEvent/Get.php +++ b/api/v3/TwingleEvent/Get.php @@ -54,14 +54,6 @@ function _civicrm_api3_twingle_event_Get_spec(array &$spec) { 'api.required' => 0, 'description' => E::ts('Twingle ID for this Event'), ]; - $spec['campaign_type_id'] = [ - 'name' => 'campaign_type_id', - 'title' => E::ts('Campaign Type'), - 'type' => CRM_Utils_Type::T_STRING, - 'api.required' => 0, - 'description' => E::ts('Campaign Type ID. Implicit FK to - cicicrm_option_value where option_group = campaign_type'), - ]; $spec['last_modified_id'] = [ 'name' => 'last_modified_id', 'title' => E::ts('Campaign Modified By'), @@ -101,15 +93,16 @@ function _civicrm_api3_twingle_event_Get_spec(array &$spec) { * @return array * API result descriptor * + * @throws CiviCRM_API3_Exception|API_Exception * @see civicrm_api3_create_success * - * @throws API_Exception */ -function civicrm_api3_twingle_event_Get($params) { +function civicrm_api3_twingle_event_Get(array $params): array { $custom_field_mapping = Cache::getInstance()->getCustomFieldMapping(); $custom_field_mapping_reverse = array_flip($custom_field_mapping); - $query = ['sequential' => 1, 'campaign_type_id' => 'twingle_event']; + $params['campaign_type_id'] = 'twingle_event'; + $query = []; foreach ($params as $key => $value) { if ( $key != 'id' && @@ -160,7 +153,6 @@ function civicrm_api3_twingle_event_Get($params) { return civicrm_api3_create_success($returnValues, $params, 'TwingleProject', 'Get'); } - else { return $result; } diff --git a/api/v3/TwingleForm/Get.php b/api/v3/TwingleForm/Get.php index f476665..be52db7 100644 --- a/api/v3/TwingleForm/Get.php +++ b/api/v3/TwingleForm/Get.php @@ -54,7 +54,7 @@ function _civicrm_api3_twingle_form_Get_spec(array &$spec) { * @see civicrm_api3_create_success * */ -function civicrm_api3_twingle_form_Get(array $params) { +function civicrm_api3_twingle_form_Get(array $params): array { // Get custom fields $custom_field_mapping = Cache::getInstance()->getCustomFieldMapping(); @@ -66,11 +66,10 @@ function civicrm_api3_twingle_form_Get(array $params) { unset($params['twingle_project_type']); } - $request = [ - 'sequential' => 1, - 'is_active' => 1, - 'campaign_type_id' => "twingle_project" - ]; + $params['campaign_type_id'] = "twingle_project"; + $params['is_active'] = 1; + $request = []; + foreach($params as $key => $param) { $request[$key] = $param; } diff --git a/api/v3/TwingleProject/Get.php b/api/v3/TwingleProject/Get.php index 827da73..2821bbd 100644 --- a/api/v3/TwingleProject/Get.php +++ b/api/v3/TwingleProject/Get.php @@ -48,14 +48,6 @@ function _civicrm_api3_twingle_project_Get_spec(array &$spec) { 'api.required' => 0, 'description' => E::ts('Twingle ID for this project'), ]; - $spec['campaign_type_id'] = [ - 'name' => 'campaign_type_id', - 'title' => E::ts('Campaign Type'), - 'type' => CRM_Utils_Type::T_STRING, - 'api.required' => 0, - 'description' => E::ts('Campaign Type ID. Implicit FK to - cicicrm_option_value where option_group = campaign_type'), - ]; $spec['last_modified_id'] = [ 'name' => 'last_modified_id', 'title' => E::ts('Campaign Modified By'), @@ -109,17 +101,17 @@ function _civicrm_api3_twingle_project_Get_spec(array &$spec) { * @return array * API result descriptor * - * @throws \CiviCRM_API3_Exception|\CiviCRM_API3_Exception + * @throws \CiviCRM_API3_Exception * @throws \API_Exception * @see civicrm_api3_create_success - * */ -function civicrm_api3_twingle_project_Get($params) { +function civicrm_api3_twingle_project_Get(array $params): array { $custom_field_mapping = Cache::getInstance()->getCustomFieldMapping(); $custom_field_mapping_reverse = array_flip($custom_field_mapping); - $query = ['sequential' => 1, 'campaign_type_id' => 'twingle_project']; + $params['campaign_type_id'] = 'twingle_project'; + $query = []; foreach ($params as $key => $value) { if ( $key != 'id' && @@ -168,7 +160,6 @@ function civicrm_api3_twingle_project_Get($params) { } } - return civicrm_api3_create_success($returnValues, $params, 'TwingleProject', 'Get'); }