From 41c9d14702af1c587aadfb3fe1e1b4bc32ed9f15 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 24 Sep 2020 12:36:52 +1200 Subject: [PATCH] dev/core#2043 Remove pass by reference --- CRM/Core/BAO/Location.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/CRM/Core/BAO/Location.php b/CRM/Core/BAO/Location.php index 6af1d85bc8..871e593267 100644 --- a/CRM/Core/BAO/Location.php +++ b/CRM/Core/BAO/Location.php @@ -57,12 +57,11 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO { if ($entity) { // this is a special case for adding values in location block table - $entityElements = [ + + $location['id'] = self::createLocBlock($location, [ 'entity_table' => $params['entity_table'], 'entity_id' => $params['entity_id'], - ]; - - $location['id'] = self::createLocBlock($location, $entityElements); + ]); } else { // when we come from a form which displays all the location elements (like the edit form or the inline block @@ -80,12 +79,12 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO { /** * Creates the entry in the civicrm_loc_block. * - * @param string $location + * @param array $location * @param array $entityElements * * @return int */ - public static function createLocBlock(&$location, &$entityElements) { + public static function createLocBlock($location, $entityElements) { $locId = self::findExisting($entityElements); $locBlock = []; @@ -116,8 +115,7 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO { return NULL; } - $locBlockInfo = self::addLocBlock($locBlock); - return $locBlockInfo->id; + return self::addLocBlock($locBlock)->id; } /** @@ -147,12 +145,11 @@ WHERE e.id = %1"; * Takes an associative array and adds location block. * * @param array $params - * (reference ) an assoc array of name/value pairs. * - * @return CRM_Core_BAO_locBlock + * @return CRM_Core_DAO_LocBlock * Object on success, null otherwise */ - public static function addLocBlock(&$params) { + public static function addLocBlock($params) { $locBlock = new CRM_Core_DAO_LocBlock(); $locBlock->copyValues($params); -- 2.25.1