Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/OptionValue.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
7b66c3b5 | 9 | * (GenCodeChecksum:f47024ac081427ddadce4c569934f8a6) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the OptionValue entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_OptionValue extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.5'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_option_value'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = TRUE; |
c3fc2621 | 32 | |
e501603b TO |
33 | /** |
34 | * Option ID | |
35 | * | |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Group which this option belongs to. | |
42 | * | |
e6ca0a57 | 43 | * @var int |
e501603b TO |
44 | */ |
45 | public $option_group_id; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * Option string as displayed to users - e.g. the label in an HTML OPTION tag. | |
49 | * | |
50 | * @var string | |
51 | */ | |
52 | public $label; | |
c3fc2621 | 53 | |
e501603b TO |
54 | /** |
55 | * 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. | |
56 | * | |
57 | * @var string | |
58 | */ | |
59 | public $value; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row. | |
63 | * | |
64 | * @var string | |
65 | */ | |
66 | public $name; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * 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. | |
70 | * | |
71 | * @var string | |
72 | */ | |
73 | public $grouping; | |
c3fc2621 | 74 | |
e501603b TO |
75 | /** |
76 | * Bitwise logic can be used to create subsets of options within an option_group for different uses. | |
77 | * | |
e6ca0a57 | 78 | * @var int |
e501603b TO |
79 | */ |
80 | public $filter; | |
c3fc2621 | 81 | |
e501603b TO |
82 | /** |
83 | * Is this the default option for the group? | |
84 | * | |
e6ca0a57 | 85 | * @var bool |
e501603b TO |
86 | */ |
87 | public $is_default; | |
c3fc2621 | 88 | |
e501603b TO |
89 | /** |
90 | * Controls display sort order. | |
91 | * | |
e6ca0a57 | 92 | * @var int |
e501603b TO |
93 | */ |
94 | public $weight; | |
c3fc2621 | 95 | |
e501603b TO |
96 | /** |
97 | * Optional description. | |
98 | * | |
99 | * @var text | |
100 | */ | |
101 | public $description; | |
c3fc2621 | 102 | |
e501603b TO |
103 | /** |
104 | * Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options? | |
105 | * | |
e6ca0a57 | 106 | * @var bool |
e501603b TO |
107 | */ |
108 | public $is_optgroup; | |
c3fc2621 | 109 | |
e501603b TO |
110 | /** |
111 | * Is this a predefined system object? | |
112 | * | |
e6ca0a57 | 113 | * @var bool |
e501603b TO |
114 | */ |
115 | public $is_reserved; | |
c3fc2621 | 116 | |
e501603b TO |
117 | /** |
118 | * Is this option active? | |
119 | * | |
e6ca0a57 | 120 | * @var bool |
e501603b TO |
121 | */ |
122 | public $is_active; | |
c3fc2621 | 123 | |
e501603b TO |
124 | /** |
125 | * Component that this option value belongs/caters to. | |
126 | * | |
e6ca0a57 | 127 | * @var int |
e501603b TO |
128 | */ |
129 | public $component_id; | |
c3fc2621 | 130 | |
e501603b TO |
131 | /** |
132 | * Which Domain is this option value for | |
133 | * | |
e6ca0a57 | 134 | * @var int |
e501603b TO |
135 | */ |
136 | public $domain_id; | |
c3fc2621 | 137 | |
e501603b | 138 | /** |
e6ca0a57 | 139 | * @var int |
e501603b TO |
140 | */ |
141 | public $visibility_id; | |
c3fc2621 | 142 | |
b412f764 CW |
143 | /** |
144 | * crm-i icon class | |
145 | * | |
146 | * @var string | |
147 | */ | |
148 | public $icon; | |
c3fc2621 | 149 | |
d73974ac CW |
150 | /** |
151 | * Hex color value e.g. #ffffff | |
152 | * | |
153 | * @var string | |
154 | */ | |
155 | public $color; | |
c3fc2621 | 156 | |
e501603b | 157 | /** |
f41f0342 | 158 | * Class constructor. |
e501603b | 159 | */ |
c3fc2621 | 160 | public function __construct() { |
e501603b TO |
161 | $this->__table = 'civicrm_option_value'; |
162 | parent::__construct(); | |
163 | } | |
c3fc2621 | 164 | |
449c4e6b CW |
165 | /** |
166 | * Returns localized title of this entity. | |
7b66c3b5 AH |
167 | * |
168 | * @param bool $plural | |
169 | * Whether to return the plural version of the title. | |
449c4e6b | 170 | */ |
7b66c3b5 AH |
171 | public static function getEntityTitle($plural = FALSE) { |
172 | return $plural ? ts('Option Values') : ts('Option Value'); | |
449c4e6b CW |
173 | } |
174 | ||
e501603b | 175 | /** |
f41f0342 | 176 | * Returns foreign keys and entity references. |
e501603b TO |
177 | * |
178 | * @return array | |
179 | * [CRM_Core_Reference_Interface] | |
180 | */ | |
c3fc2621 | 181 | public static function getReferenceColumns() { |
346aaaba | 182 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 183 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
184 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'option_group_id', 'civicrm_option_group', 'id'); |
185 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'component_id', 'civicrm_component', 'id'); | |
186 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); | |
346aaaba | 187 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 188 | } |
346aaaba | 189 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 190 | } |
c3fc2621 | 191 | |
e501603b TO |
192 | /** |
193 | * Returns all the column names of this table | |
194 | * | |
195 | * @return array | |
196 | */ | |
c3fc2621 | 197 | public static function &fields() { |
346aaaba | 198 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
199 | Civi::$statics[__CLASS__]['fields'] = [ |
200 | 'id' => [ | |
e501603b TO |
201 | 'name' => 'id', |
202 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 203 | 'title' => ts('Option Value ID'), |
215b423e | 204 | 'description' => ts('Option ID'), |
c3fc2621 | 205 | 'required' => TRUE, |
a36434b9 | 206 | 'where' => 'civicrm_option_value.id', |
522a26c9 | 207 | 'table_name' => 'civicrm_option_value', |
208 | 'entity' => 'OptionValue', | |
209 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 210 | 'localizable' => 0, |
a9d0587b | 211 | 'add' => '1.5', |
c3fc2621 CW |
212 | ], |
213 | 'option_group_id' => [ | |
e501603b TO |
214 | 'name' => 'option_group_id', |
215 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 216 | 'title' => ts('Option Group ID'), |
215b423e | 217 | 'description' => ts('Group which this option belongs to.'), |
c3fc2621 | 218 | 'required' => TRUE, |
a36434b9 | 219 | 'where' => 'civicrm_option_value.option_group_id', |
522a26c9 | 220 | 'table_name' => 'civicrm_option_value', |
221 | 'entity' => 'OptionValue', | |
222 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 223 | 'localizable' => 0, |
e501603b | 224 | 'FKClassName' => 'CRM_Core_DAO_OptionGroup', |
c3fc2621 | 225 | 'html' => [ |
e501603b | 226 | 'type' => 'Select', |
c3fc2621 CW |
227 | ], |
228 | 'pseudoconstant' => [ | |
e501603b TO |
229 | 'table' => 'civicrm_option_group', |
230 | 'keyColumn' => 'id', | |
17f78bae CW |
231 | 'labelColumn' => 'title', |
232 | 'nameColumn' => 'name', | |
e6ca0a57 | 233 | ], |
a9d0587b | 234 | 'add' => '1.5', |
c3fc2621 CW |
235 | ], |
236 | 'label' => [ | |
e501603b TO |
237 | 'name' => 'label', |
238 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 239 | 'title' => ts('Option Label'), |
215b423e | 240 | 'description' => ts('Option string as displayed to users - e.g. the label in an HTML OPTION tag.'), |
c3fc2621 | 241 | 'required' => TRUE, |
e501603b TO |
242 | 'maxlength' => 512, |
243 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 244 | 'where' => 'civicrm_option_value.label', |
522a26c9 | 245 | 'table_name' => 'civicrm_option_value', |
246 | 'entity' => 'OptionValue', | |
247 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 248 | 'localizable' => 1, |
a9d0587b | 249 | 'add' => '1.5', |
c3fc2621 CW |
250 | ], |
251 | 'value' => [ | |
e501603b TO |
252 | 'name' => 'value', |
253 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 254 | 'title' => ts('Option Value'), |
215b423e | 255 | '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.'), |
c3fc2621 | 256 | 'required' => TRUE, |
e501603b TO |
257 | 'maxlength' => 512, |
258 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 259 | 'where' => 'civicrm_option_value.value', |
522a26c9 | 260 | 'table_name' => 'civicrm_option_value', |
261 | 'entity' => 'OptionValue', | |
262 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 263 | 'localizable' => 0, |
a9d0587b | 264 | 'add' => '1.5', |
c3fc2621 CW |
265 | ], |
266 | 'name' => [ | |
e501603b TO |
267 | 'name' => 'name', |
268 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 269 | 'title' => ts('Option Name'), |
215b423e | 270 | '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.'), |
e501603b TO |
271 | 'maxlength' => 255, |
272 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 273 | 'import' => TRUE, |
e501603b | 274 | 'where' => 'civicrm_option_value.name', |
c3fc2621 | 275 | 'export' => TRUE, |
522a26c9 | 276 | 'table_name' => 'civicrm_option_value', |
277 | 'entity' => 'OptionValue', | |
278 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 279 | 'localizable' => 0, |
a9d0587b | 280 | 'add' => '1.5', |
c3fc2621 CW |
281 | ], |
282 | 'grouping' => [ | |
e501603b TO |
283 | 'name' => 'grouping', |
284 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 285 | 'title' => ts('Option Grouping Name'), |
215b423e | 286 | '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.'), |
e501603b TO |
287 | 'maxlength' => 255, |
288 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 289 | 'where' => 'civicrm_option_value.grouping', |
522a26c9 | 290 | 'table_name' => 'civicrm_option_value', |
291 | 'entity' => 'OptionValue', | |
292 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 293 | 'localizable' => 0, |
a9d0587b | 294 | 'add' => '1.5', |
c3fc2621 CW |
295 | ], |
296 | 'filter' => [ | |
e501603b TO |
297 | 'name' => 'filter', |
298 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 299 | 'title' => ts('Filter'), |
215b423e | 300 | 'description' => ts('Bitwise logic can be used to create subsets of options within an option_group for different uses.'), |
a36434b9 | 301 | 'where' => 'civicrm_option_value.filter', |
b8be3222 | 302 | 'default' => '0', |
522a26c9 | 303 | 'table_name' => 'civicrm_option_value', |
304 | 'entity' => 'OptionValue', | |
305 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 306 | 'localizable' => 0, |
a9d0587b | 307 | 'add' => '1.5', |
c3fc2621 CW |
308 | ], |
309 | 'is_default' => [ | |
e501603b TO |
310 | 'name' => 'is_default', |
311 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 312 | 'title' => ts('Option is Default?'), |
215b423e | 313 | 'description' => ts('Is this the default option for the group?'), |
a36434b9 | 314 | 'where' => 'civicrm_option_value.is_default', |
45a83e42 | 315 | 'default' => '0', |
522a26c9 | 316 | 'table_name' => 'civicrm_option_value', |
317 | 'entity' => 'OptionValue', | |
318 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 319 | 'localizable' => 0, |
a9d0587b | 320 | 'add' => '1.5', |
c3fc2621 CW |
321 | ], |
322 | 'weight' => [ | |
e501603b TO |
323 | 'name' => 'weight', |
324 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 325 | 'title' => ts('Order'), |
215b423e | 326 | 'description' => ts('Controls display sort order.'), |
c3fc2621 | 327 | 'required' => TRUE, |
a36434b9 | 328 | 'where' => 'civicrm_option_value.weight', |
522a26c9 | 329 | 'table_name' => 'civicrm_option_value', |
330 | 'entity' => 'OptionValue', | |
331 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 332 | 'localizable' => 0, |
a9d0587b | 333 | 'add' => '1.5', |
c3fc2621 CW |
334 | ], |
335 | 'description' => [ | |
e501603b TO |
336 | 'name' => 'description', |
337 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 338 | 'title' => ts('Option Description'), |
215b423e | 339 | 'description' => ts('Optional description.'), |
e501603b TO |
340 | 'rows' => 8, |
341 | 'cols' => 60, | |
a36434b9 | 342 | 'where' => 'civicrm_option_value.description', |
522a26c9 | 343 | 'table_name' => 'civicrm_option_value', |
344 | 'entity' => 'OptionValue', | |
345 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 346 | 'localizable' => 1, |
c3fc2621 | 347 | 'html' => [ |
e501603b | 348 | 'type' => 'TextArea', |
c3fc2621 | 349 | ], |
a9d0587b | 350 | 'add' => '1.5', |
c3fc2621 CW |
351 | ], |
352 | 'is_optgroup' => [ | |
e501603b TO |
353 | 'name' => 'is_optgroup', |
354 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 355 | 'title' => ts('Option is Header?'), |
215b423e | 356 | '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?'), |
a36434b9 | 357 | 'where' => 'civicrm_option_value.is_optgroup', |
45a83e42 | 358 | 'default' => '0', |
522a26c9 | 359 | 'table_name' => 'civicrm_option_value', |
360 | 'entity' => 'OptionValue', | |
361 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 362 | 'localizable' => 0, |
a9d0587b | 363 | 'add' => '1.5', |
c3fc2621 CW |
364 | ], |
365 | 'is_reserved' => [ | |
e501603b TO |
366 | 'name' => 'is_reserved', |
367 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 368 | 'title' => ts('Option Is Reserved?'), |
215b423e | 369 | 'description' => ts('Is this a predefined system object?'), |
a36434b9 | 370 | 'where' => 'civicrm_option_value.is_reserved', |
45a83e42 | 371 | 'default' => '0', |
522a26c9 | 372 | 'table_name' => 'civicrm_option_value', |
373 | 'entity' => 'OptionValue', | |
374 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 375 | 'localizable' => 0, |
a9d0587b | 376 | 'add' => '1.5', |
c3fc2621 CW |
377 | ], |
378 | 'is_active' => [ | |
e501603b TO |
379 | 'name' => 'is_active', |
380 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 381 | 'title' => ts('Option Is Active'), |
215b423e | 382 | 'description' => ts('Is this option active?'), |
a36434b9 | 383 | 'where' => 'civicrm_option_value.is_active', |
e501603b | 384 | 'default' => '1', |
522a26c9 | 385 | 'table_name' => 'civicrm_option_value', |
386 | 'entity' => 'OptionValue', | |
387 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 388 | 'localizable' => 0, |
a9d0587b | 389 | 'add' => '1.5', |
c3fc2621 CW |
390 | ], |
391 | 'component_id' => [ | |
e501603b TO |
392 | 'name' => 'component_id', |
393 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 394 | 'title' => ts('Option Component'), |
215b423e | 395 | 'description' => ts('Component that this option value belongs/caters to.'), |
a36434b9 | 396 | 'where' => 'civicrm_option_value.component_id', |
522a26c9 | 397 | 'table_name' => 'civicrm_option_value', |
398 | 'entity' => 'OptionValue', | |
399 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 400 | 'localizable' => 0, |
e501603b | 401 | 'FKClassName' => 'CRM_Core_DAO_Component', |
c3fc2621 | 402 | 'html' => [ |
e501603b | 403 | 'type' => 'Select', |
c3fc2621 CW |
404 | ], |
405 | 'pseudoconstant' => [ | |
e501603b TO |
406 | 'table' => 'civicrm_component', |
407 | 'keyColumn' => 'id', | |
408 | 'labelColumn' => 'name', | |
e6ca0a57 | 409 | ], |
a9d0587b | 410 | 'add' => '2.0', |
c3fc2621 CW |
411 | ], |
412 | 'domain_id' => [ | |
e501603b TO |
413 | 'name' => 'domain_id', |
414 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 415 | 'title' => ts('Option Domain'), |
215b423e | 416 | 'description' => ts('Which Domain is this option value for'), |
a36434b9 | 417 | 'where' => 'civicrm_option_value.domain_id', |
522a26c9 | 418 | 'table_name' => 'civicrm_option_value', |
419 | 'entity' => 'OptionValue', | |
420 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 421 | 'localizable' => 0, |
e501603b | 422 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 423 | 'pseudoconstant' => [ |
e501603b TO |
424 | 'table' => 'civicrm_domain', |
425 | 'keyColumn' => 'id', | |
426 | 'labelColumn' => 'name', | |
e6ca0a57 | 427 | ], |
a9d0587b | 428 | 'add' => '3.1', |
c3fc2621 CW |
429 | ], |
430 | 'visibility_id' => [ | |
e501603b TO |
431 | 'name' => 'visibility_id', |
432 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 433 | 'title' => ts('Option Visibility'), |
a36434b9 | 434 | 'where' => 'civicrm_option_value.visibility_id', |
e501603b | 435 | 'default' => 'NULL', |
522a26c9 | 436 | 'table_name' => 'civicrm_option_value', |
437 | 'entity' => 'OptionValue', | |
438 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 439 | 'localizable' => 0, |
e78e618d PN |
440 | 'pseudoconstant' => [ |
441 | 'optionGroupName' => 'visibility', | |
442 | 'optionEditPath' => 'civicrm/admin/options/visibility', | |
e6ca0a57 | 443 | ], |
a9d0587b | 444 | 'add' => '2.2', |
c3fc2621 CW |
445 | ], |
446 | 'icon' => [ | |
b412f764 CW |
447 | 'name' => 'icon', |
448 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 449 | 'title' => ts('Icon'), |
215b423e | 450 | 'description' => ts('crm-i icon class'), |
b412f764 CW |
451 | 'maxlength' => 255, |
452 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 453 | 'where' => 'civicrm_option_value.icon', |
b412f764 | 454 | 'default' => 'NULL', |
522a26c9 | 455 | 'table_name' => 'civicrm_option_value', |
456 | 'entity' => 'OptionValue', | |
457 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 458 | 'localizable' => 0, |
a9d0587b | 459 | 'add' => '4.7', |
c3fc2621 CW |
460 | ], |
461 | 'color' => [ | |
d73974ac CW |
462 | 'name' => 'color', |
463 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 464 | 'title' => ts('Color'), |
215b423e | 465 | 'description' => ts('Hex color value e.g. #ffffff'), |
d73974ac CW |
466 | 'maxlength' => 255, |
467 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 468 | 'where' => 'civicrm_option_value.color', |
d73974ac | 469 | 'default' => 'NULL', |
522a26c9 | 470 | 'table_name' => 'civicrm_option_value', |
471 | 'entity' => 'OptionValue', | |
472 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 473 | 'localizable' => 0, |
a9d0587b | 474 | 'add' => '4.7', |
c3fc2621 CW |
475 | ], |
476 | ]; | |
346aaaba | 477 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 478 | } |
346aaaba | 479 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 480 | } |
c3fc2621 | 481 | |
e501603b | 482 | /** |
bd8e0b14 | 483 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
484 | * |
485 | * @return array | |
bd8e0b14 | 486 | * Array(string $name => string $uniqueName). |
e501603b | 487 | */ |
c3fc2621 | 488 | public static function &fieldKeys() { |
bd8e0b14 TO |
489 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
490 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 491 | } |
bd8e0b14 | 492 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 493 | } |
c3fc2621 | 494 | |
e501603b TO |
495 | /** |
496 | * Returns the names of this table | |
497 | * | |
498 | * @return string | |
499 | */ | |
c3fc2621 | 500 | public static function getTableName() { |
e501603b TO |
501 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
502 | } | |
c3fc2621 | 503 | |
e501603b TO |
504 | /** |
505 | * Returns if this table needs to be logged | |
506 | * | |
c3fc2621 | 507 | * @return bool |
e501603b | 508 | */ |
c3fc2621 | 509 | public function getLog() { |
e501603b TO |
510 | return self::$_log; |
511 | } | |
c3fc2621 | 512 | |
e501603b TO |
513 | /** |
514 | * Returns the list of fields that can be imported | |
515 | * | |
516 | * @param bool $prefix | |
517 | * | |
518 | * @return array | |
519 | */ | |
c3fc2621 CW |
520 | public static function &import($prefix = FALSE) { |
521 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_value', $prefix, []); | |
60808919 | 522 | return $r; |
e501603b | 523 | } |
c3fc2621 | 524 | |
e501603b TO |
525 | /** |
526 | * Returns the list of fields that can be exported | |
527 | * | |
528 | * @param bool $prefix | |
529 | * | |
530 | * @return array | |
531 | */ | |
c3fc2621 CW |
532 | public static function &export($prefix = FALSE) { |
533 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_value', $prefix, []); | |
60808919 | 534 | return $r; |
e501603b | 535 | } |
c3fc2621 | 536 | |
e7a6b91a AS |
537 | /** |
538 | * Returns the list of indices | |
c3fc2621 CW |
539 | * |
540 | * @param bool $localize | |
541 | * | |
542 | * @return array | |
e7a6b91a AS |
543 | */ |
544 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
545 | $indices = [ |
546 | 'index_option_group_id_value' => [ | |
e7a6b91a | 547 | 'name' => 'index_option_group_id_value', |
c3fc2621 | 548 | 'field' => [ |
e7a6b91a AS |
549 | 0 => 'value(128)', |
550 | 1 => 'option_group_id', | |
c3fc2621 CW |
551 | ], |
552 | 'localizable' => FALSE, | |
e7a6b91a | 553 | 'sig' => 'civicrm_option_value::0::value(128)::option_group_id', |
c3fc2621 CW |
554 | ], |
555 | 'index_option_group_id_name' => [ | |
e7a6b91a | 556 | 'name' => 'index_option_group_id_name', |
c3fc2621 | 557 | 'field' => [ |
e7a6b91a AS |
558 | 0 => 'name(128)', |
559 | 1 => 'option_group_id', | |
c3fc2621 CW |
560 | ], |
561 | 'localizable' => FALSE, | |
e7a6b91a | 562 | 'sig' => 'civicrm_option_value::0::name(128)::option_group_id', |
c3fc2621 CW |
563 | ], |
564 | ]; | |
e7a6b91a AS |
565 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
566 | } | |
c3fc2621 | 567 | |
e501603b | 568 | } |