code cleanup

This commit is contained in:
Marc Michalsky forumZFD 2021-02-11 18:35:35 +01:00
parent 027b7a40cd
commit dc2c26abb4
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
3 changed files with 15 additions and 11 deletions

View file

@ -102,9 +102,11 @@ function civicrm_api3_twingle_event_Getsingle(array $params): array {
_civicrm_api3_twingle_event_Getsingle_spec($allowed_params);
$params = array_intersect_key($params, $allowed_params);
// Get TwingleEvent by provided parameters
$returnValues = civicrm_api3('TwingleEvent', 'get', $params);
$count = $returnValues['count'];
// Check whether only a single TwingleEvent is found
if ($count != 1) {
return civicrm_api3_create_error("Expected one TwingleEvent but found $count");
}