Stop calling deprectated del function
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 1 Mar 2023 19:44:34 +0000 (08:44 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 1 Mar 2023 19:49:27 +0000 (08:49 +1300)
api/v3/Event.php
api/v3/MembershipStatus.php

index bfedf30a9cc4e184ee9a75cf4ccb9db3dc24ac72..750f7c4625db4d26836a4c0ba47999a47ca4949b 100644 (file)
@@ -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();
 }
 
 /**
index c4f6fa5f2ed641a5b115f250876961c7d8ff2eed..036f2afbb20093060948deb5153bbc6bef0ecc1c 100644 (file)
@@ -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();
 }