5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Core/OptionValue.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:8cf699b034cbd9d7b8fe0a69250a79ba)
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 static $_tableName = 'civicrm_option_value';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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' => 'Option ID',
194 'table_name' => 'civicrm_option_value',
195 'entity' => 'OptionValue',
196 'bao' => 'CRM_Core_BAO_OptionValue',
199 'option_group_id' => [
200 'name' => 'option_group_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Option Group ID'),
203 'description' => 'Group which this option belongs to.',
205 'table_name' => 'civicrm_option_value',
206 'entity' => 'OptionValue',
207 'bao' => 'CRM_Core_BAO_OptionValue',
209 'FKClassName' => 'CRM_Core_DAO_OptionGroup',
213 'pseudoconstant' => [
214 'table' => 'civicrm_option_group',
216 'labelColumn' => 'name',
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Option Label'),
223 'description' => 'Option string as displayed to users - e.g. the label in an HTML OPTION tag.',
226 'size' => CRM_Utils_Type
::HUGE
,
227 'table_name' => 'civicrm_option_value',
228 'entity' => 'OptionValue',
229 'bao' => 'CRM_Core_BAO_OptionValue',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Option Value'),
236 'description' => '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.',
239 'size' => CRM_Utils_Type
::HUGE
,
240 'table_name' => 'civicrm_option_value',
241 'entity' => 'OptionValue',
242 'bao' => 'CRM_Core_BAO_OptionValue',
247 'type' => CRM_Utils_Type
::T_STRING
,
248 'title' => ts('Option Name'),
249 'description' => 'Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.',
251 'size' => CRM_Utils_Type
::HUGE
,
253 'where' => 'civicrm_option_value.name',
254 'headerPattern' => '',
257 'table_name' => 'civicrm_option_value',
258 'entity' => 'OptionValue',
259 'bao' => 'CRM_Core_BAO_OptionValue',
263 'name' => 'grouping',
264 'type' => CRM_Utils_Type
::T_STRING
,
265 'title' => ts('Option Grouping Name'),
266 'description' => '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.',
268 'size' => CRM_Utils_Type
::HUGE
,
269 'table_name' => 'civicrm_option_value',
270 'entity' => 'OptionValue',
271 'bao' => 'CRM_Core_BAO_OptionValue',
276 'type' => CRM_Utils_Type
::T_INT
,
277 'title' => ts('Filter'),
278 'description' => 'Bitwise logic can be used to create subsets of options within an option_group for different uses.',
279 'table_name' => 'civicrm_option_value',
280 'entity' => 'OptionValue',
281 'bao' => 'CRM_Core_BAO_OptionValue',
285 'name' => 'is_default',
286 'type' => CRM_Utils_Type
::T_BOOLEAN
,
287 'title' => ts('Option is Default?'),
288 'description' => 'Is this the default option for the group?',
289 'table_name' => 'civicrm_option_value',
290 'entity' => 'OptionValue',
291 'bao' => 'CRM_Core_BAO_OptionValue',
296 'type' => CRM_Utils_Type
::T_INT
,
297 'title' => ts('Order'),
298 'description' => 'Controls display sort order.',
300 'table_name' => 'civicrm_option_value',
301 'entity' => 'OptionValue',
302 'bao' => 'CRM_Core_BAO_OptionValue',
306 'name' => 'description',
307 'type' => CRM_Utils_Type
::T_TEXT
,
308 'title' => ts('Option Description'),
309 'description' => 'Optional description.',
312 'table_name' => 'civicrm_option_value',
313 'entity' => 'OptionValue',
314 'bao' => 'CRM_Core_BAO_OptionValue',
317 'type' => 'TextArea',
321 'name' => 'is_optgroup',
322 'type' => CRM_Utils_Type
::T_BOOLEAN
,
323 'title' => ts('Option is Header?'),
324 'description' => 'Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?',
325 'table_name' => 'civicrm_option_value',
326 'entity' => 'OptionValue',
327 'bao' => 'CRM_Core_BAO_OptionValue',
331 'name' => 'is_reserved',
332 'type' => CRM_Utils_Type
::T_BOOLEAN
,
333 'title' => ts('Option Is Reserved?'),
334 'description' => 'Is this a predefined system object?',
335 'table_name' => 'civicrm_option_value',
336 'entity' => 'OptionValue',
337 'bao' => 'CRM_Core_BAO_OptionValue',
341 'name' => 'is_active',
342 'type' => CRM_Utils_Type
::T_BOOLEAN
,
343 'title' => ts('Option Is Active'),
344 'description' => 'Is this option active?',
346 'table_name' => 'civicrm_option_value',
347 'entity' => 'OptionValue',
348 'bao' => 'CRM_Core_BAO_OptionValue',
352 'name' => 'component_id',
353 'type' => CRM_Utils_Type
::T_INT
,
354 'title' => ts('Option Component'),
355 'description' => 'Component that this option value belongs/caters to.',
356 'table_name' => 'civicrm_option_value',
357 'entity' => 'OptionValue',
358 'bao' => 'CRM_Core_BAO_OptionValue',
360 'FKClassName' => 'CRM_Core_DAO_Component',
364 'pseudoconstant' => [
365 'table' => 'civicrm_component',
367 'labelColumn' => 'name',
371 'name' => 'domain_id',
372 'type' => CRM_Utils_Type
::T_INT
,
373 'title' => ts('Option Domain'),
374 'description' => 'Which Domain is this option value for',
375 'table_name' => 'civicrm_option_value',
376 'entity' => 'OptionValue',
377 'bao' => 'CRM_Core_BAO_OptionValue',
379 'FKClassName' => 'CRM_Core_DAO_Domain',
380 'pseudoconstant' => [
381 'table' => 'civicrm_domain',
383 'labelColumn' => 'name',
387 'name' => 'visibility_id',
388 'type' => CRM_Utils_Type
::T_INT
,
389 'title' => ts('Option Visibility'),
391 'table_name' => 'civicrm_option_value',
392 'entity' => 'OptionValue',
393 'bao' => 'CRM_Core_BAO_OptionValue',
398 'type' => CRM_Utils_Type
::T_STRING
,
399 'title' => ts('Icon'),
400 'description' => 'crm-i icon class',
402 'size' => CRM_Utils_Type
::HUGE
,
404 'table_name' => 'civicrm_option_value',
405 'entity' => 'OptionValue',
406 'bao' => 'CRM_Core_BAO_OptionValue',
411 'type' => CRM_Utils_Type
::T_STRING
,
412 'title' => ts('Color'),
413 'description' => 'Hex color value e.g. #ffffff',
415 'size' => CRM_Utils_Type
::HUGE
,
417 'table_name' => 'civicrm_option_value',
418 'entity' => 'OptionValue',
419 'bao' => 'CRM_Core_BAO_OptionValue',
423 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
425 return Civi
::$statics[__CLASS__
]['fields'];
429 * Return a mapping from field-name to the corresponding key (as used in fields()).
432 * Array(string $name => string $uniqueName).
434 public static function &fieldKeys() {
435 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
436 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
438 return Civi
::$statics[__CLASS__
]['fieldKeys'];
442 * Returns the names of this table
446 public static function getTableName() {
447 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
451 * Returns if this table needs to be logged
455 public function getLog() {
460 * Returns the list of fields that can be imported
462 * @param bool $prefix
466 public static function &import($prefix = FALSE) {
467 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'option_value', $prefix, []);
472 * Returns the list of fields that can be exported
474 * @param bool $prefix
478 public static function &export($prefix = FALSE) {
479 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'option_value', $prefix, []);
484 * Returns the list of indices
486 * @param bool $localize
490 public static function indices($localize = TRUE) {
492 'index_option_group_id_value' => [
493 'name' => 'index_option_group_id_value',
496 1 => 'option_group_id',
498 'localizable' => FALSE,
499 'sig' => 'civicrm_option_value::0::value(128)::option_group_id',
501 'index_option_group_id_name' => [
502 'name' => 'index_option_group_id_name',
505 1 => 'option_group_id',
507 'localizable' => FALSE,
508 'sig' => 'civicrm_option_value::0::name(128)::option_group_id',
511 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;