✅️ meet standard for getsingle api response
return array with object values instead of api success response
This commit is contained in:
parent
88a77456b8
commit
d904ae931f
11 changed files with 59 additions and 95 deletions
|
@ -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',
|
||||
|
|
|
@ -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']];
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue