5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/OptionValue.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7aa11987c26800632c3798b4cfce95c1)
13 * Database access object for the OptionValue entity.
15 class CRM_Core_DAO_OptionValue
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_option_value';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * Group which this option belongs to.
43 public $option_group_id;
46 * Option string as displayed to users - e.g. the label in an HTML OPTION tag.
53 * The actual value stored (as a foreign key) in the data record. Functions which need lookup option_value.title should use civicrm_option_value.option_group_id plus civicrm_option_value.value as the key.
60 * Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.
67 * Use to sort and/or set display properties for sub-set(s) of options within an option group. EXAMPLE: Use for college_interest field, to differentiate partners from non-partners.
74 * Bitwise logic can be used to create subsets of options within an option_group for different uses.
81 * Is this the default option for the group?
88 * Controls display sort order.
95 * Optional description.
102 * Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?
109 * Is this a predefined system object?
116 * Is this option active?
123 * Component that this option value belongs/caters to.
127 public $component_id;
130 * Which Domain is this option value for
139 public $visibility_id;
149 * Hex color value e.g. #ffffff
158 public function __construct() {
159 $this->__table
= 'civicrm_option_value';
160 parent
::__construct();
164 * Returns foreign keys and entity references.
167 * [CRM_Core_Reference_Interface]
169 public static function getReferenceColumns() {
170 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
171 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
172 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'option_group_id', 'civicrm_option_group', 'id');
173 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'component_id', 'civicrm_component', 'id');
174 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
175 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
177 return Civi
::$statics[__CLASS__
]['links'];
181 * Returns all the column names of this table
185 public static function &fields() {
186 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
187 Civi
::$statics[__CLASS__
]['fields'] = [
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Option Value ID'),
192 'description' => ts('Option ID'),
194 'where' => 'civicrm_option_value.id',
195 'table_name' => 'civicrm_option_value',
196 'entity' => 'OptionValue',
197 'bao' => 'CRM_Core_BAO_OptionValue',
200 'option_group_id' => [
201 'name' => 'option_group_id',
202 'type' => CRM_Utils_Type
::T_INT
,
203 'title' => ts('Option Group ID'),
204 'description' => ts('Group which this option belongs to.'),
206 'where' => 'civicrm_option_value.option_group_id',
207 'table_name' => 'civicrm_option_value',
208 'entity' => 'OptionValue',
209 'bao' => 'CRM_Core_BAO_OptionValue',
211 'FKClassName' => 'CRM_Core_DAO_OptionGroup',
215 'pseudoconstant' => [
216 'table' => 'civicrm_option_group',
218 'labelColumn' => 'title',
219 'nameColumn' => 'name',
224 'type' => CRM_Utils_Type
::T_STRING
,
225 'title' => ts('Option Label'),
226 'description' => ts('Option string as displayed to users - e.g. the label in an HTML OPTION tag.'),
229 'size' => CRM_Utils_Type
::HUGE
,
230 'where' => 'civicrm_option_value.label',
231 'table_name' => 'civicrm_option_value',
232 'entity' => 'OptionValue',
233 'bao' => 'CRM_Core_BAO_OptionValue',
238 'type' => CRM_Utils_Type
::T_STRING
,
239 'title' => ts('Option Value'),
240 'description' => ts('The actual value stored (as a foreign key) in the data record. Functions which need lookup option_value.title should use civicrm_option_value.option_group_id plus civicrm_option_value.value as the key.'),
243 'size' => CRM_Utils_Type
::HUGE
,
244 'where' => 'civicrm_option_value.value',
245 'table_name' => 'civicrm_option_value',
246 'entity' => 'OptionValue',
247 'bao' => 'CRM_Core_BAO_OptionValue',
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('Option Name'),
254 'description' => ts('Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.'),
256 'size' => CRM_Utils_Type
::HUGE
,
258 'where' => 'civicrm_option_value.name',
260 'table_name' => 'civicrm_option_value',
261 'entity' => 'OptionValue',
262 'bao' => 'CRM_Core_BAO_OptionValue',
266 'name' => 'grouping',
267 'type' => CRM_Utils_Type
::T_STRING
,
268 'title' => ts('Option Grouping Name'),
269 'description' => ts('Use to sort and/or set display properties for sub-set(s) of options within an option group. EXAMPLE: Use for college_interest field, to differentiate partners from non-partners.'),
271 'size' => CRM_Utils_Type
::HUGE
,
272 'where' => 'civicrm_option_value.grouping',
273 'table_name' => 'civicrm_option_value',
274 'entity' => 'OptionValue',
275 'bao' => 'CRM_Core_BAO_OptionValue',
280 'type' => CRM_Utils_Type
::T_INT
,
281 'title' => ts('Filter'),
282 'description' => ts('Bitwise logic can be used to create subsets of options within an option_group for different uses.'),
283 'where' => 'civicrm_option_value.filter',
285 'table_name' => 'civicrm_option_value',
286 'entity' => 'OptionValue',
287 'bao' => 'CRM_Core_BAO_OptionValue',
291 'name' => 'is_default',
292 'type' => CRM_Utils_Type
::T_BOOLEAN
,
293 'title' => ts('Option is Default?'),
294 'description' => ts('Is this the default option for the group?'),
295 'where' => 'civicrm_option_value.is_default',
297 'table_name' => 'civicrm_option_value',
298 'entity' => 'OptionValue',
299 'bao' => 'CRM_Core_BAO_OptionValue',
304 'type' => CRM_Utils_Type
::T_INT
,
305 'title' => ts('Order'),
306 'description' => ts('Controls display sort order.'),
308 'where' => 'civicrm_option_value.weight',
309 'table_name' => 'civicrm_option_value',
310 'entity' => 'OptionValue',
311 'bao' => 'CRM_Core_BAO_OptionValue',
315 'name' => 'description',
316 'type' => CRM_Utils_Type
::T_TEXT
,
317 'title' => ts('Option Description'),
318 'description' => ts('Optional description.'),
321 'where' => 'civicrm_option_value.description',
322 'table_name' => 'civicrm_option_value',
323 'entity' => 'OptionValue',
324 'bao' => 'CRM_Core_BAO_OptionValue',
327 'type' => 'TextArea',
331 'name' => 'is_optgroup',
332 'type' => CRM_Utils_Type
::T_BOOLEAN
,
333 'title' => ts('Option is Header?'),
334 'description' => ts('Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?'),
335 'where' => 'civicrm_option_value.is_optgroup',
337 'table_name' => 'civicrm_option_value',
338 'entity' => 'OptionValue',
339 'bao' => 'CRM_Core_BAO_OptionValue',
343 'name' => 'is_reserved',
344 'type' => CRM_Utils_Type
::T_BOOLEAN
,
345 'title' => ts('Option Is Reserved?'),
346 'description' => ts('Is this a predefined system object?'),
347 'where' => 'civicrm_option_value.is_reserved',
349 'table_name' => 'civicrm_option_value',
350 'entity' => 'OptionValue',
351 'bao' => 'CRM_Core_BAO_OptionValue',
355 'name' => 'is_active',
356 'type' => CRM_Utils_Type
::T_BOOLEAN
,
357 'title' => ts('Option Is Active'),
358 'description' => ts('Is this option active?'),
359 'where' => 'civicrm_option_value.is_active',
361 'table_name' => 'civicrm_option_value',
362 'entity' => 'OptionValue',
363 'bao' => 'CRM_Core_BAO_OptionValue',
367 'name' => 'component_id',
368 'type' => CRM_Utils_Type
::T_INT
,
369 'title' => ts('Option Component'),
370 'description' => ts('Component that this option value belongs/caters to.'),
371 'where' => 'civicrm_option_value.component_id',
372 'table_name' => 'civicrm_option_value',
373 'entity' => 'OptionValue',
374 'bao' => 'CRM_Core_BAO_OptionValue',
376 'FKClassName' => 'CRM_Core_DAO_Component',
380 'pseudoconstant' => [
381 'table' => 'civicrm_component',
383 'labelColumn' => 'name',
387 'name' => 'domain_id',
388 'type' => CRM_Utils_Type
::T_INT
,
389 'title' => ts('Option Domain'),
390 'description' => ts('Which Domain is this option value for'),
391 'where' => 'civicrm_option_value.domain_id',
392 'table_name' => 'civicrm_option_value',
393 'entity' => 'OptionValue',
394 'bao' => 'CRM_Core_BAO_OptionValue',
396 'FKClassName' => 'CRM_Core_DAO_Domain',
397 'pseudoconstant' => [
398 'table' => 'civicrm_domain',
400 'labelColumn' => 'name',
404 'name' => 'visibility_id',
405 'type' => CRM_Utils_Type
::T_INT
,
406 'title' => ts('Option Visibility'),
407 'where' => 'civicrm_option_value.visibility_id',
409 'table_name' => 'civicrm_option_value',
410 'entity' => 'OptionValue',
411 'bao' => 'CRM_Core_BAO_OptionValue',
413 'pseudoconstant' => [
414 'optionGroupName' => 'visibility',
415 'optionEditPath' => 'civicrm/admin/options/visibility',
420 'type' => CRM_Utils_Type
::T_STRING
,
421 'title' => ts('Icon'),
422 'description' => ts('crm-i icon class'),
424 'size' => CRM_Utils_Type
::HUGE
,
425 'where' => 'civicrm_option_value.icon',
427 'table_name' => 'civicrm_option_value',
428 'entity' => 'OptionValue',
429 'bao' => 'CRM_Core_BAO_OptionValue',
434 'type' => CRM_Utils_Type
::T_STRING
,
435 'title' => ts('Color'),
436 'description' => ts('Hex color value e.g. #ffffff'),
438 'size' => CRM_Utils_Type
::HUGE
,
439 'where' => 'civicrm_option_value.color',
441 'table_name' => 'civicrm_option_value',
442 'entity' => 'OptionValue',
443 'bao' => 'CRM_Core_BAO_OptionValue',
447 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
449 return Civi
::$statics[__CLASS__
]['fields'];
453 * Return a mapping from field-name to the corresponding key (as used in fields()).
456 * Array(string $name => string $uniqueName).
458 public static function &fieldKeys() {
459 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
460 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
462 return Civi
::$statics[__CLASS__
]['fieldKeys'];
466 * Returns the names of this table
470 public static function getTableName() {
471 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
475 * Returns if this table needs to be logged
479 public function getLog() {
484 * Returns the list of fields that can be imported
486 * @param bool $prefix
490 public static function &import($prefix = FALSE) {
491 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_value', $prefix, []);
496 * Returns the list of fields that can be exported
498 * @param bool $prefix
502 public static function &export($prefix = FALSE) {
503 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_value', $prefix, []);
508 * Returns the list of indices
510 * @param bool $localize
514 public static function indices($localize = TRUE) {
516 'index_option_group_id_value' => [
517 'name' => 'index_option_group_id_value',
520 1 => 'option_group_id',
522 'localizable' => FALSE,
523 'sig' => 'civicrm_option_value::0::value(128)::option_group_id',
525 'index_option_group_id_name' => [
526 'name' => 'index_option_group_id_name',
529 1 => 'option_group_id',
531 'localizable' => FALSE,
532 'sig' => 'civicrm_option_value::0::name(128)::option_group_id',
535 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;