From 29a1db5d36303abbd9c17ad14218534c0dff3d17 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 2 Mar 2023 08:44:34 +1300 Subject: [PATCH] Stop calling deprectated del function --- api/v3/Event.php | 7 +++++-- api/v3/MembershipStatus.php | 11 ++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api/v3/Event.php b/api/v3/Event.php index bfedf30a9c..750f7c4625 100644 --- a/api/v3/Event.php +++ b/api/v3/Event.php @@ -165,9 +165,12 @@ function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id) { * @param array $params * * @return array + * @throws \CRM_Core_Exception + * @noinspection PhpUnused */ -function civicrm_api3_event_delete($params) { - return CRM_Event_BAO_Event::del($params['id']) ? civicrm_api3_create_success() : civicrm_api3_create_error(ts('Error while deleting event')); +function civicrm_api3_event_delete(array $params): array { + CRM_Event_BAO_Event::deleteRecord($params); + return civicrm_api3_create_success(); } /** diff --git a/api/v3/MembershipStatus.php b/api/v3/MembershipStatus.php index c4f6fa5f2e..036f2afbb2 100644 --- a/api/v3/MembershipStatus.php +++ b/api/v3/MembershipStatus.php @@ -105,16 +105,13 @@ function civicrm_api3_membership_status_update($params) { * This API is used for deleting a membership status * * @param array $params + * * @return array * @throws CRM_Core_Exception - * @throws CRM_Core_Exception + * @noinspection PhpUnused */ -function civicrm_api3_membership_status_delete($params) { - - $memberStatusDelete = CRM_Member_BAO_MembershipStatus::del($params['id'], TRUE); - if ($memberStatusDelete) { - throw new CRM_Core_Exception($memberStatusDelete['error_message']); - } +function civicrm_api3_membership_status_delete(array $params): array { + CRM_Member_BAO_MembershipStatus::deleteRecord($params); return civicrm_api3_create_success(); } -- 2.25.1