provide TwingleEvent campaign id for instantiation
This commit is contained in:
Marc Michalsky forumZFD 2021-02-04 09:36:26 +01:00
parent d031c82f31
commit aef0297daf
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
3 changed files with 11 additions and 7 deletions

View file

@ -96,11 +96,17 @@ function _civicrm_api3_twingle_event_Getsingle_spec(array &$spec) {
* @see civicrm_api3_create_success
*/
function civicrm_api3_twingle_event_Getsingle(array $params): array {
$returnValues = civicrm_api3('TwingleEvent', 'get', $params);
$count = $returnValues['count'];
if ($count != 1) {
return civicrm_api3_create_error("Expected one TwingleEvent but found $count");
}
return civicrm_api3_create_success($returnValues['values'], $params, 'TwingleEvent', 'Getsingle');
return civicrm_api3_create_success(
$returnValues['values'][$returnValues['id']],
$params,
'TwingleEvent',
'Getsingle'
);
}