Fix theoretical regression
[civicrm-core.git] / CRM / Event / Form / Registration.php
index dd9635767c9b4f65a81ab50c0bc2982a161b6b1c..f6a19f5d864954ab74b9cc86f605c382fdf71958 100644 (file)
@@ -806,7 +806,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
       'status_id' => CRM_Utils_Array::value('participant_status',
         $params, 1
       ),
-      'role_id' => CRM_Utils_Array::value('participant_role_id', $params) ?: self::getDefaultRoleID(),
+      'role_id' => CRM_Utils_Array::value('participant_role_id', $params) ?: CRM_Event_BAO_Participant::getDefaultRoleID(),
       'register_date' => ($registerDate) ? $registerDate : date('YmdHis'),
       'source' => CRM_Utils_String::ellipsify(
         isset($params['participant_source']) ? CRM_Utils_Array::value('participant_source', $params) : CRM_Utils_Array::value('description', $params),
@@ -858,21 +858,6 @@ class CRM_Event_Form_Registration extends CRM_Core_Form {
     return $participant;
   }
 
-  /**
-   * Get the ID of the default (first) participant role
-   *
-   * @return int
-   * @throws \CiviCRM_API3_Exception
-   */
-  private 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"],
-    ]);
-  }
-
   /**
    * Calculate the total participant count as per params.
    *