X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FBAO%2FParticipant.php;h=f134201cc436ff695a0f6d89943ca0fc1c058163;hb=fc076fe3fbe3fd15336c3cf32427f8d88c858f95;hp=bb64e184776e38737ed69ba92e5a9da4dabe171c;hpb=075e18d327223282b0a37f6309dd5802700b6715;p=civicrm-core.git diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index bb64e18477..f134201cc4 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -969,6 +969,21 @@ WHERE civicrm_participant.id = {$participantId} } } + /** + * Get the ID of the default (first) participant role + * + * @return int + * @throws \CiviCRM_API3_Exception + */ + public static function getDefaultRoleID() { + return (int) civicrm_api3('OptionValue', 'getvalue', [ + 'return' => 'value', + 'option_group_id' => 'participant_role', + 'is_active' => 1, + 'options' => ['limit' => 1, 'sort' => 'is_default DESC'], + ]); + } + /** * Get the additional participant ids. *