X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCase%2FXMLProcessor.php;h=614dbf8c95088adfff06228c8b10ca5ca03498cc;hb=f1211d7555c3f037e86fb25c37d1f3115fa43f68;hp=49a63387352fa40fac07889f0be3907199acf9fa;hpb=b4be480a90da537cf7df77530e653afde19f3f9d;p=civicrm-core.git diff --git a/CRM/Case/XMLProcessor.php b/CRM/Case/XMLProcessor.php index 49a6338735..614dbf8c95 100644 --- a/CRM/Case/XMLProcessor.php +++ b/CRM/Case/XMLProcessor.php @@ -1,9 +1,9 @@ string $relTypeCname) + */ + public static $activityTypes = NULL; + + /** + * FIXME: This does *NOT* belong in a static property, but we're too late in + * the 4.5-cycle to do the necessary cleanup. + * + * @var array|null array(int $id => string $relTypeCname) + */ + public static $relationshipTypes = NULL; + /** * Relationship-types have four name fields (name_a_b, name_b_a, label_a_b, * label_b_a), but CiviCase XML refers to reltypes by a single name. @@ -85,30 +101,35 @@ class CRM_Case_XMLProcessor { * * @return array */ - function &allActivityTypes($indexName = TRUE, $all = FALSE) { - static $activityTypes = NULL; - if (!$activityTypes) { - $activityTypes = CRM_Case_PseudoConstant::caseActivityType($indexName, $all); + public function &allActivityTypes($indexName = TRUE, $all = FALSE) { + if (self::$activityTypes === NULL) { + self::$activityTypes = CRM_Case_PseudoConstant::caseActivityType($indexName, $all); } - return $activityTypes; + return self::$activityTypes; } /** * @return array */ - function &allRelationshipTypes() { - static $relationshipTypes = array(); - - if (!$relationshipTypes) { - $relationshipInfo = CRM_Core_PseudoConstant::relationshipType(); + public function &allRelationshipTypes() { + if (self::$relationshipTypes === NULL) { + $relationshipInfo = CRM_Core_PseudoConstant::relationshipType('label', TRUE); - $relationshipTypes = array(); + self::$relationshipTypes = array(); foreach ($relationshipInfo as $id => $info) { - $relationshipTypes[$id] = $info[CRM_Case_XMLProcessor::REL_TYPE_CNAME]; + self::$relationshipTypes[$id] = $info[CRM_Case_XMLProcessor::REL_TYPE_CNAME]; } } - return $relationshipTypes; + return self::$relationshipTypes; + } + + /** + * FIXME: This should not exist + */ + public static function flushStaticCaches() { + self::$activityTypes = NULL; + self::$relationshipTypes = NULL; } -} +}