From: eileen Date: Tue, 24 Jan 2017 01:08:27 +0000 (+1300) Subject: Towards CRM-19815 refactor cached clause to use Civi:Statics X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=33a766c6f9e136b91195566ef4581311ce01ea40;p=civicrm-core.git Towards CRM-19815 refactor cached clause to use Civi:Statics --- diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index c323b4f7a8..e09ddd64d1 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -32,13 +32,6 @@ */ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { - /** - * Static field for all the export/import contribution fields. - * - * @var array - */ - static $_contributionFields = NULL; - static $_contribOrSoftCredit = "only_contribs"; static $_contribRecurPayment = NULL; @@ -54,16 +47,12 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query { * Associative array of contribution fields */ public static function getFields($checkPermission = TRUE) { - if (!self::$_contributionFields) { - self::$_contributionFields = array(); - - $fields = CRM_Contribute_BAO_Contribution::exportableFields($checkPermission); - + if (!isset(\Civi::$statics[__CLASS__]) || !isset(\Civi::$statics[__CLASS__]['fields']) || !isset(\Civi::$statics[__CLASS__]['contribution'])) { + $fields = CRM_Contribute_BAO_Contribution::exportableFields($checkPermission); unset($fields['contribution_contact_id']); - - self::$_contributionFields = $fields; + \Civi::$statics[__CLASS__]['fields']['contribution'] = $fields; } - return self::$_contributionFields; + return \Civi::$statics[__CLASS__]['fields']['contribution']; } /** diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index 94c28b4dfc..8079cec6f2 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -1428,7 +1428,7 @@ class CRM_Utils_System { CRM_Contact_BAO_Contact::$_importableFields = CRM_Contact_BAO_Contact::$_exportableFields = CRM_Contribute_BAO_Contribution::$_importableFields = CRM_Contribute_BAO_Contribution::$_exportableFields - = CRM_Pledge_BAO_Pledge::$_exportableFields = CRM_Contribute_BAO_Query::$_contributionFields + = CRM_Pledge_BAO_Pledge::$_exportableFields = CRM_Core_BAO_CustomField::$_importFields = CRM_Core_BAO_Cache::$_cache = CRM_Core_DAO::$_dbColumnValueCache = NULL;