From b45959fce7a000e621ce5db7a2e081983f140957 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 25 Nov 2022 14:49:06 +1300 Subject: [PATCH] Remove legacyCreateMultiple function This was annotated deprecated 7 years ago, is called 'legacy' and was nosily deprecated 10 months ago. It IS still called from one jma extenion but I think it's OK to remove with a ping --- CRM/Contact/BAO/Relationship.php | 79 -------------------------------- 1 file changed, 79 deletions(-) diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index fd99c8841b..f4c97866f8 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -141,85 +141,6 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship implemen ]; } - /** - * Only called from import now... plus one place outside of core & tests. - * - * @todo - deprecate more aggressively - will involve copying to the import - * class, adding a deprecation notice here & removing from tests. - * - * Takes an associative array and creates a relationship object. - * - * @deprecated For single creates use the api instead (it's tested). - * For multiple a new variant of this function needs to be written and migrated to as this is a bit - * nasty - * - * @param array $params - * (reference ) an assoc array of name/value pairs. - * @param array $ids - * The array that holds all the db ids. - * per http://wiki.civicrm.org/confluence/display/CRM/Database+layer - * "we are moving away from the $ids param " - * - * @return array - * @throws \CRM_Core_Exception - */ - public static function legacyCreateMultiple($params, $ids = []) { - CRM_Core_Error::deprecatedFunctionWarning('api v4'); - // clarify that the only key ever pass in the ids array is 'contact' - // There is legacy handling for other keys but a universe search on - // calls to this function (not supported to be called from outside core) - // only returns 2 calls - one in CRM_Contact_Import_Parser_Contact - // and the other in jma grant applications (CRM_Grant_Form_Grant_Confirm) - // both only pass in contact as a key here. - $contactID = $ids['contact']; - unset($ids); - // There is only ever one value passed in from the 2 places above that call - // this - by clarifying here like this we can cleanup within this - // function without having to do more universe searches. - $relatedContactID = key($params['contact_check']); - - // check if the relationship is valid between contacts. - // step 1: check if the relationship is valid if not valid skip and keep the count - // step 2: check the if two contacts already have a relationship if yes skip and keep the count - // step 3: if valid relationship then add the relation and keep the count - - // step 1 - [$contactFields['relationship_type_id'], $firstLetter, $secondLetter] = explode('_', $params['relationship_type_id']); - $contactFields['contact_id_' . $firstLetter] = $contactID; - $contactFields['contact_id_' . $secondLetter] = $relatedContactID; - if (!CRM_Contact_BAO_Relationship::checkRelationshipType($contactFields['contact_id_a'], $contactFields['contact_id_b'], - $contactFields['relationship_type_id'])) { - return [0, 0]; - } - - //CRM-16978:check duplicate relationship as per case id. - // https://issues.civicrm.org/jira/browse/CRM-16978 - if ($caseId = CRM_Utils_Array::value('case_id', $params)) { - CRM_Core_Error::deprecatedWarning('this code is believed to be unreachable'); - $contactFields['case_id'] = $caseId; - } - if ( - self::checkDuplicateRelationship( - $contactFields, - (int) $contactID, - // step 2 - (int) $relatedContactID - ) - ) { - return [0, 1]; - } - - $singleInstanceParams = array_merge($params, $contactFields); - $relationship = self::add($singleInstanceParams); - - // do not add to recent items for import, CRM-4399 - if (empty($params['skipRecentView'])) { - self::addRecent($params, $relationship); - } - - return [1, 0]; - } - /** * This is the function that check/add if the relationship created is valid. * -- 2.25.1