️ meet standard for getsingle api response

return array with object values instead of api success response
This commit is contained in:
Marc Michalsky forumZFD 2021-03-09 20:51:03 +01:00
parent 88a77456b8
commit d904ae931f
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
11 changed files with 59 additions and 95 deletions

View file

@ -83,11 +83,11 @@ function civicrm_api3_twingle_event_Delete(array $params): array {
// provided parameters
if ($params['id']) {
$events[] = civicrm_api3('TwingleEvent', 'getsingle',
[$params['id']])['values'];
[$params['id']]);
}
elseif ($params['event_id']) {
$events[] = civicrm_api3('TwingleEvent', 'getsingle',
[$params['event_id']])['values'];
[$params['event_id']]);
}
elseif ($params['project_id']) {
$events = civicrm_api3('TwingleEvent', 'get',

View file

@ -110,10 +110,5 @@ function civicrm_api3_twingle_event_Getsingle(array $params): array {
if ($count != 1) {
return civicrm_api3_create_error("Expected one TwingleEvent but found $count");
}
return civicrm_api3_create_success(
$returnValues['values'][$returnValues['id']],
$params,
'TwingleEvent',
'Getsingle'
);
return $returnValues['values'][$returnValues['id']];
}

View file

@ -120,15 +120,15 @@ function civicrm_api3_twingle_event_Sync(array $params): array {
if ($result['is_error'] == 0) {
// Get the event from Twingle
if ($result['values']['event_id']) {
if ($result['event_id']) {
$event_from_twingle = $twingleApi->getEvent(
$result['values']['project_id'],
$result['values']['event_id']
$result['project_id'],
$result['event_id']
);
// instantiate event from CiviCRM
try {
$event = _instantiateEvent($result['values']);
$event = _instantiateEvent($result);
} catch (CiviCRM_API3_Exception $e) {
Civi::log()->error(
$e->getMessage(),