CRM_Core_PseudoConstant::stateProvinceAbbreviation(), TRUE
);
}
- $validStates[] = CRM_Utils_Array::value('state_province_id', $states);
+ $validStates[] = $states['state_province_id'] ?? NULL;
}
$value = implode(CRM_Core_DAO::VALUE_SEPARATOR,
$validStates
CRM_Core_PseudoConstant::countryIsoCode(), TRUE
);
}
- $validCountries[] = CRM_Utils_Array::value('country_id', $countries);
+ $validCountries[] = $countries['country_id'] ?? NULL;
}
$value = implode(CRM_Core_DAO::VALUE_SEPARATOR,
$validCountries
case 'File':
if (!$field['file_id']) {
- CRM_Core_Error::fatal();
+ throw new CRM_Core_Exception('Missing parameter file_id');
}
// need to add/update civicrm_entity_file
$count++;
}
- $fieldExtends = CRM_Utils_Array::value('extends', $field);
+ $fieldExtends = $field['extends'] ?? NULL;
if (
CRM_Utils_Array::value('entity_table', $field) == 'civicrm_contact'
|| $fieldExtends == 'Contact'
|| $fieldExtends == 'Organization'
|| $fieldExtends == 'Household'
) {
- $paramFieldsExtendContactForEntities[$entityID]['custom_' . CRM_Utils_Array::value('custom_field_id', $field)] = CRM_Utils_Array::value('custom_field_id', $field);
+ $paramFieldsExtendContactForEntities[$entityID]['custom_' . CRM_Utils_Array::value('custom_field_id', $field)] = $field['custom_field_id'] ?? NULL;
}
}
return 'datetime';
default:
- CRM_Core_Error::fatal();
+ throw new CRM_Core_Exception('Invalid Field Type');
}
}
* Array of custom values for the entity with key=>value
* pairs specified as civicrm_custom_field.id => custom value.
* Empty array if no custom values found.
+ * @throws CRM_Core_Exception
*/
public static function &getEntityValues($entityID, $entityType = NULL, $fieldIDs = NULL, $formatMultiRecordField = FALSE, $DTparams = NULL) {
if (!$entityID) {
// adding this here since an empty contact id could have serious repurcussions
// like looping forever
- CRM_Core_Error::fatal('Please file an issue with the backtrace');
+ throw new CRM_Core_Exception('Please file an issue with the backtrace');
return NULL;
}
}
$fields[$dao->table_name][] = $dao->fieldID;
$select[$dao->table_name][] = "{$dao->column_name} AS custom_{$dao->fieldID}";
- $isMultiple[$dao->table_name] = $dao->is_multiple ? TRUE : FALSE;
+ $isMultiple[$dao->table_name] = (bool) $dao->is_multiple;
$file[$dao->table_name][$dao->fieldID] = $dao->fieldDataType;
}