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