From b5ad33a8f35f5eaabae1385d938f8d32ef621aca Mon Sep 17 00:00:00 2001 From: colemanw Date: Sat, 8 Aug 2026 12:52:39 -0400 Subject: [PATCH] Migrate getDefaultRoleID() to use APIv4 --- CRM/Event/BAO/Participant.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 9f8f8c5a9bb1..1e2d564899f8 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1131,12 +1131,14 @@ public static function fixEventLevel(&$eventLevel) { * @throws \CRM_Core_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'], - ]); + return (int) \Civi\Api4\OptionValue::get(FALSE) + ->addSelect('value') + ->addWhere('option_group_id:name', '=', 'participant_role') + ->addWhere('is_active', '=', TRUE) + ->addOrderBy('is_default', 'DESC') + ->setLimit(1) + ->execute() + ->first()['value']; } /**