From ec47f7b4bd016411762668825fb71ec04e9ebec2 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 17 Sep 2020 08:51:17 +1200 Subject: [PATCH] dev/core#2046 Rationalise add vs create on email BAO This folds the 2 functions into one, deprecating add --- CRM/Core/BAO/Email.php | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/CRM/Core/BAO/Email.php b/CRM/Core/BAO/Email.php index 0dd1bca05a..5854cdb679 100644 --- a/CRM/Core/BAO/Email.php +++ b/CRM/Core/BAO/Email.php @@ -36,21 +36,6 @@ class CRM_Core_BAO_Email extends CRM_Core_DAO_Email { CRM_Core_BAO_Block::handlePrimary($params, get_class()); } - $email = CRM_Core_BAO_Email::add($params); - - return $email; - } - - /** - * Takes an associative array and adds email. - * - * @param array $params - * (reference ) an assoc array of name/value pairs. - * - * @return object - * CRM_Core_BAO_Email object on success, null otherwise - */ - public static function add(&$params) { $hook = empty($params['id']) ? 'create' : 'edit'; CRM_Utils_Hook::pre($hook, 'Email', CRM_Utils_Array::value('id', $params), $params); @@ -98,6 +83,20 @@ WHERE contact_id = {$params['contact_id']} return $email; } + /** + * Takes an associative array and adds email. + * + * @param array $params + * (reference ) an assoc array of name/value pairs. + * + * @return object + * CRM_Core_BAO_Email object on success, null otherwise + */ + public static function add(&$params) { + CRM_Core_Error::deprecatedFunctionWarning('apiv4 create'); + return self::create($params); + } + /** * Given the list of params in the params array, fetch the object * and store the values in the values array -- 2.25.1