*
* Generated from xml/schema/CRM/Core/OptionValue.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:83c97e8281f7ceb605ed4e462abf25ee)
+ * (GenCodeChecksum:5997192c77d86867e8d13c353dd02351)
*/
/**
parent::__construct();
}
+ /**
+ * Returns localized title of this entity.
+ */
+ public static function getEntityTitle() {
+ return ts('Option Values');
+ }
+
/**
* Returns foreign keys and entity references.
*
'title' => ts('Filter'),
'description' => ts('Bitwise logic can be used to create subsets of options within an option_group for different uses.'),
'where' => 'civicrm_option_value.filter',
- 'default' => 'NULL',
+ 'default' => '0',
'table_name' => 'civicrm_option_value',
'entity' => 'OptionValue',
'bao' => 'CRM_Core_BAO_OptionValue',
while ($dao->fetch()) {
$tmp = [];
foreach ($fields as $key) {
- if (array_key_exists($key, $dao)) {
+ if (property_exists($dao, $key)) {
// not sure on that one
if ($dao->$key !== NULL) {
$tmp[$key] = $dao->$key;
$fields = _civicrm_api3_build_fields_array($dao, $uniqueFields);
foreach ($fields as $key => $value) {
- if (array_key_exists($key, $dao)) {
- $values[$key] = $dao->$key;
+ if (property_exists($dao, $key)) {
+ $values[$key] = $dao->$key ?? NULL;
}
}
}
// CiviMagic syntax for Nulling out the field - let it through.
return;
}
+ // Legacy support for custom fields: If matching failed by name, fallback to label
+ // @see https://lab.civicrm.org/dev/core/-/issues/1816
+ if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($fieldName)) {
+ $field = new CRM_Core_BAO_CustomField();
+ $field->id = $customFieldId;
+ $options = array_map("strtolower", $field->getOptions());
+ $newValue = array_search(strtolower($value), $options);
+ }
+ }
+ if ($newValue === FALSE) {
throw new API_Exception("'$value' is not a valid option for field $fieldName", 2001, ['error_field' => $fieldName]);
}
$value = $newValue;