From 388eb91b2d1a32c938538e655629dd238ab92307 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 23 Mar 2020 10:41:34 -0400 Subject: [PATCH] Deprecate redundant api3 util function --- Civi/API/SelectQuery.php | 2 +- api/v3/utils.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Civi/API/SelectQuery.php b/Civi/API/SelectQuery.php index d7c6d3f127..a089ef869f 100644 --- a/Civi/API/SelectQuery.php +++ b/Civi/API/SelectQuery.php @@ -85,7 +85,7 @@ abstract class SelectQuery { $baoName = _civicrm_api3_get_BAO($entity); $bao = new $baoName(); - $this->entityFieldNames = _civicrm_api3_field_names(_civicrm_api3_build_fields_array($bao)); + $this->entityFieldNames = array_column($baoName::fields(), 'name'); $this->apiFieldSpec = $this->getFields(); $this->query = \CRM_Utils_SQL_Select::from($bao->tableName() . ' ' . self::MAIN_TABLE_ALIAS); diff --git a/api/v3/utils.php b/api/v3/utils.php index 3c9ded7475..958ad94361 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -457,11 +457,13 @@ function _civicrm_api3_store_values(&$fields, &$params, &$values) { /** * Returns field names of the given entity fields. * + * @deprecated * @param array $fields * Fields array to retrieve the field names for. * @return array */ function _civicrm_api3_field_names($fields) { + CRM_Core_Error::deprecatedFunctionWarning('array_column'); $result = []; foreach ($fields as $key => $value) { if (!empty($value['name'])) { -- 2.25.1