* RelationshipType
* @var array
*/
- private static $relationshipType;
+ private static $relationshipType = [];
/**
* Civicrm groups that are not smart groups
$dao = new $daoName();
$fieldSpec = $dao->getFieldSpec($fieldName);
- // Ensure we have the canonical name for this field
- $fieldName = CRM_Utils_Array::value('name', $fieldSpec, $fieldName);
-
// Return false if field doesn't exist.
if (empty($fieldSpec)) {
return FALSE;
}
- elseif (!empty($fieldSpec['pseudoconstant'])) {
+ // Ensure we have the canonical name for this field
+ $fieldName = $fieldSpec['name'] ?? $fieldName;
+
+ if (!empty($fieldSpec['pseudoconstant'])) {
$pseudoconstant = $fieldSpec['pseudoconstant'];
// if callback is specified..
// Merge params with schema defaults
$params += [
- 'condition' => CRM_Utils_Array::value('condition', $pseudoconstant, []),
- 'keyColumn' => CRM_Utils_Array::value('keyColumn', $pseudoconstant),
- 'labelColumn' => CRM_Utils_Array::value('labelColumn', $pseudoconstant),
+ 'condition' => $pseudoconstant['condition'] ?? [],
+ 'keyColumn' => $pseudoconstant['keyColumn'] ?? NULL,
+ 'labelColumn' => $pseudoconstant['labelColumn'] ?? NULL,
];
// Fetch option group from option_value table
if ($values === FALSE) {
return FALSE;
}
- return CRM_Utils_Array::value($key, $values);
+ return $values[$key] ?? NULL;
}
/**
if ($values === FALSE) {
return FALSE;
}
- return CRM_Utils_Array::value($key, $values);
+ return $values[$key] ?? NULL;
}
/**
* @return array
* array reference of all relationship types.
*/
- public static function &relationshipType($valueColumnName = 'label', $reset = FALSE, $isActive = 1) {
+ public static function relationshipType($valueColumnName = 'label', $reset = FALSE, $isActive = 1) {
$cacheKey = $valueColumnName . '::' . $isActive;
- if (!CRM_Utils_Array::value($cacheKey, self::$relationshipType) || $reset) {
+ if (!isset(self::$relationshipType[$cacheKey]) || $reset) {
self::$relationshipType[$cacheKey] = [];
//now we have name/label columns CRM-3336
self::$accountOptionValues[$cacheKey] = CRM_Core_OptionGroup::values($optionGroupName, FALSE, FALSE, FALSE, $condition);
}
if ($id) {
- return CRM_Utils_Array::value($id, self::$accountOptionValues[$cacheKey]);
+ return self::$accountOptionValues[$cacheKey][$id] ?? NULL;
}
return self::$accountOptionValues[$cacheKey];