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:b07a5bf40414e7b7c35fe49a1900df68)
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' => 'name',
223 'type' => CRM_Utils_Type
::T_STRING
,
224 'title' => ts('Option Label'),
225 'description' => ts('Option string as displayed to users - e.g. the label in an HTML OPTION tag.'),
228 'size' => CRM_Utils_Type
::HUGE
,
229 'where' => 'civicrm_option_value.label',
230 'table_name' => 'civicrm_option_value',
231 'entity' => 'OptionValue',
232 'bao' => 'CRM_Core_BAO_OptionValue',
237 'type' => CRM_Utils_Type
::T_STRING
,
238 'title' => ts('Option Value'),
239 '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.'),
242 'size' => CRM_Utils_Type
::HUGE
,
243 'where' => 'civicrm_option_value.value',
244 'table_name' => 'civicrm_option_value',
245 'entity' => 'OptionValue',
246 'bao' => 'CRM_Core_BAO_OptionValue',
251 'type' => CRM_Utils_Type
::T_STRING
,
252 'title' => ts('Option Name'),
253 '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.'),
255 'size' => CRM_Utils_Type
::HUGE
,
257 'where' => 'civicrm_option_value.name',
259 'table_name' => 'civicrm_option_value',
260 'entity' => 'OptionValue',
261 'bao' => 'CRM_Core_BAO_OptionValue',
265 'name' => 'grouping',
266 'type' => CRM_Utils_Type
::T_STRING
,
267 'title' => ts('Option Grouping Name'),
268 '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.'),
270 'size' => CRM_Utils_Type
::HUGE
,
271 'where' => 'civicrm_option_value.grouping',
272 'table_name' => 'civicrm_option_value',
273 'entity' => 'OptionValue',
274 'bao' => 'CRM_Core_BAO_OptionValue',
279 'type' => CRM_Utils_Type
::T_INT
,
280 'title' => ts('Filter'),
281 'description' => ts('Bitwise logic can be used to create subsets of options within an option_group for different uses.'),
282 'where' => 'civicrm_option_value.filter',
283 'table_name' => 'civicrm_option_value',
284 'entity' => 'OptionValue',
285 'bao' => 'CRM_Core_BAO_OptionValue',
289 'name' => 'is_default',
290 'type' => CRM_Utils_Type
::T_BOOLEAN
,
291 'title' => ts('Option is Default?'),
292 'description' => ts('Is this the default option for the group?'),
293 'where' => 'civicrm_option_value.is_default',
295 'table_name' => 'civicrm_option_value',
296 'entity' => 'OptionValue',
297 'bao' => 'CRM_Core_BAO_OptionValue',
302 'type' => CRM_Utils_Type
::T_INT
,
303 'title' => ts('Order'),
304 'description' => ts('Controls display sort order.'),
306 'where' => 'civicrm_option_value.weight',
307 'table_name' => 'civicrm_option_value',
308 'entity' => 'OptionValue',
309 'bao' => 'CRM_Core_BAO_OptionValue',
313 'name' => 'description',
314 'type' => CRM_Utils_Type
::T_TEXT
,
315 'title' => ts('Option Description'),
316 'description' => ts('Optional description.'),
319 'where' => 'civicrm_option_value.description',
320 'table_name' => 'civicrm_option_value',
321 'entity' => 'OptionValue',
322 'bao' => 'CRM_Core_BAO_OptionValue',
325 'type' => 'TextArea',
329 'name' => 'is_optgroup',
330 'type' => CRM_Utils_Type
::T_BOOLEAN
,
331 'title' => ts('Option is Header?'),
332 '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?'),
333 'where' => 'civicrm_option_value.is_optgroup',
335 'table_name' => 'civicrm_option_value',
336 'entity' => 'OptionValue',
337 'bao' => 'CRM_Core_BAO_OptionValue',
341 'name' => 'is_reserved',
342 'type' => CRM_Utils_Type
::T_BOOLEAN
,
343 'title' => ts('Option Is Reserved?'),
344 'description' => ts('Is this a predefined system object?'),
345 'where' => 'civicrm_option_value.is_reserved',
347 'table_name' => 'civicrm_option_value',
348 'entity' => 'OptionValue',
349 'bao' => 'CRM_Core_BAO_OptionValue',
353 'name' => 'is_active',
354 'type' => CRM_Utils_Type
::T_BOOLEAN
,
355 'title' => ts('Option Is Active'),
356 'description' => ts('Is this option active?'),
357 'where' => 'civicrm_option_value.is_active',
359 'table_name' => 'civicrm_option_value',
360 'entity' => 'OptionValue',
361 'bao' => 'CRM_Core_BAO_OptionValue',
365 'name' => 'component_id',
366 'type' => CRM_Utils_Type
::T_INT
,
367 'title' => ts('Option Component'),
368 'description' => ts('Component that this option value belongs/caters to.'),
369 'where' => 'civicrm_option_value.component_id',
370 'table_name' => 'civicrm_option_value',
371 'entity' => 'OptionValue',
372 'bao' => 'CRM_Core_BAO_OptionValue',
374 'FKClassName' => 'CRM_Core_DAO_Component',
378 'pseudoconstant' => [
379 'table' => 'civicrm_component',
381 'labelColumn' => 'name',
385 'name' => 'domain_id',
386 'type' => CRM_Utils_Type
::T_INT
,
387 'title' => ts('Option Domain'),
388 'description' => ts('Which Domain is this option value for'),
389 'where' => 'civicrm_option_value.domain_id',
390 'table_name' => 'civicrm_option_value',
391 'entity' => 'OptionValue',
392 'bao' => 'CRM_Core_BAO_OptionValue',
394 'FKClassName' => 'CRM_Core_DAO_Domain',
395 'pseudoconstant' => [
396 'table' => 'civicrm_domain',
398 'labelColumn' => 'name',
402 'name' => 'visibility_id',
403 'type' => CRM_Utils_Type
::T_INT
,
404 'title' => ts('Option Visibility'),
405 'where' => 'civicrm_option_value.visibility_id',
407 'table_name' => 'civicrm_option_value',
408 'entity' => 'OptionValue',
409 'bao' => 'CRM_Core_BAO_OptionValue',
411 'pseudoconstant' => [
412 'optionGroupName' => 'visibility',
413 'optionEditPath' => 'civicrm/admin/options/visibility',
418 'type' => CRM_Utils_Type
::T_STRING
,
419 'title' => ts('Icon'),
420 'description' => ts('crm-i icon class'),
422 'size' => CRM_Utils_Type
::HUGE
,
423 'where' => 'civicrm_option_value.icon',
425 'table_name' => 'civicrm_option_value',
426 'entity' => 'OptionValue',
427 'bao' => 'CRM_Core_BAO_OptionValue',
432 'type' => CRM_Utils_Type
::T_STRING
,
433 'title' => ts('Color'),
434 'description' => ts('Hex color value e.g. #ffffff'),
436 'size' => CRM_Utils_Type
::HUGE
,
437 'where' => 'civicrm_option_value.color',
439 'table_name' => 'civicrm_option_value',
440 'entity' => 'OptionValue',
441 'bao' => 'CRM_Core_BAO_OptionValue',
445 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
447 return Civi
::$statics[__CLASS__
]['fields'];
451 * Return a mapping from field-name to the corresponding key (as used in fields()).
454 * Array(string $name => string $uniqueName).
456 public static function &fieldKeys() {
457 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
458 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
460 return Civi
::$statics[__CLASS__
]['fieldKeys'];
464 * Returns the names of this table
468 public static function getTableName() {
469 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
473 * Returns if this table needs to be logged
477 public function getLog() {
482 * Returns the list of fields that can be imported
484 * @param bool $prefix
488 public static function &import($prefix = FALSE) {
489 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_value', $prefix, []);
494 * Returns the list of fields that can be exported
496 * @param bool $prefix
500 public static function &export($prefix = FALSE) {
501 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_value', $prefix, []);
506 * Returns the list of indices
508 * @param bool $localize
512 public static function indices($localize = TRUE) {
514 'index_option_group_id_value' => [
515 'name' => 'index_option_group_id_value',
518 1 => 'option_group_id',
520 'localizable' => FALSE,
521 'sig' => 'civicrm_option_value::0::value(128)::option_group_id',
523 'index_option_group_id_name' => [
524 'name' => 'index_option_group_id_name',
527 1 => 'option_group_id',
529 'localizable' => FALSE,
530 'sig' => 'civicrm_option_value::0::name(128)::option_group_id',
533 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;