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 | |
0298dd55 | 9 | * (GenCodeChecksum:7aa11987c26800632c3798b4cfce95c1) |
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', |
0298dd55 | 284 | 'default' => 'NULL', |
522a26c9 | 285 | 'table_name' => 'civicrm_option_value', |
286 | 'entity' => 'OptionValue', | |
287 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 288 | 'localizable' => 0, |
c3fc2621 CW |
289 | ], |
290 | 'is_default' => [ | |
e501603b TO |
291 | 'name' => 'is_default', |
292 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 293 | 'title' => ts('Option is Default?'), |
215b423e | 294 | 'description' => ts('Is this the default option for the group?'), |
a36434b9 | 295 | 'where' => 'civicrm_option_value.is_default', |
45a83e42 | 296 | 'default' => '0', |
522a26c9 | 297 | 'table_name' => 'civicrm_option_value', |
298 | 'entity' => 'OptionValue', | |
299 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 300 | 'localizable' => 0, |
c3fc2621 CW |
301 | ], |
302 | 'weight' => [ | |
e501603b TO |
303 | 'name' => 'weight', |
304 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 305 | 'title' => ts('Order'), |
215b423e | 306 | 'description' => ts('Controls display sort order.'), |
c3fc2621 | 307 | 'required' => TRUE, |
a36434b9 | 308 | 'where' => 'civicrm_option_value.weight', |
522a26c9 | 309 | 'table_name' => 'civicrm_option_value', |
310 | 'entity' => 'OptionValue', | |
311 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 312 | 'localizable' => 0, |
c3fc2621 CW |
313 | ], |
314 | 'description' => [ | |
e501603b TO |
315 | 'name' => 'description', |
316 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 317 | 'title' => ts('Option Description'), |
215b423e | 318 | 'description' => ts('Optional description.'), |
e501603b TO |
319 | 'rows' => 8, |
320 | 'cols' => 60, | |
a36434b9 | 321 | 'where' => 'civicrm_option_value.description', |
522a26c9 | 322 | 'table_name' => 'civicrm_option_value', |
323 | 'entity' => 'OptionValue', | |
324 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 325 | 'localizable' => 1, |
c3fc2621 | 326 | 'html' => [ |
e501603b | 327 | 'type' => 'TextArea', |
c3fc2621 CW |
328 | ], |
329 | ], | |
330 | 'is_optgroup' => [ | |
e501603b TO |
331 | 'name' => 'is_optgroup', |
332 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 333 | 'title' => ts('Option is Header?'), |
215b423e | 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?'), |
a36434b9 | 335 | 'where' => 'civicrm_option_value.is_optgroup', |
45a83e42 | 336 | 'default' => '0', |
522a26c9 | 337 | 'table_name' => 'civicrm_option_value', |
338 | 'entity' => 'OptionValue', | |
339 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 340 | 'localizable' => 0, |
c3fc2621 CW |
341 | ], |
342 | 'is_reserved' => [ | |
e501603b TO |
343 | 'name' => 'is_reserved', |
344 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 345 | 'title' => ts('Option Is Reserved?'), |
215b423e | 346 | 'description' => ts('Is this a predefined system object?'), |
a36434b9 | 347 | 'where' => 'civicrm_option_value.is_reserved', |
45a83e42 | 348 | 'default' => '0', |
522a26c9 | 349 | 'table_name' => 'civicrm_option_value', |
350 | 'entity' => 'OptionValue', | |
351 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 352 | 'localizable' => 0, |
c3fc2621 CW |
353 | ], |
354 | 'is_active' => [ | |
e501603b TO |
355 | 'name' => 'is_active', |
356 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 357 | 'title' => ts('Option Is Active'), |
215b423e | 358 | 'description' => ts('Is this option active?'), |
a36434b9 | 359 | 'where' => 'civicrm_option_value.is_active', |
e501603b | 360 | 'default' => '1', |
522a26c9 | 361 | 'table_name' => 'civicrm_option_value', |
362 | 'entity' => 'OptionValue', | |
363 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 364 | 'localizable' => 0, |
c3fc2621 CW |
365 | ], |
366 | 'component_id' => [ | |
e501603b TO |
367 | 'name' => 'component_id', |
368 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 369 | 'title' => ts('Option Component'), |
215b423e | 370 | 'description' => ts('Component that this option value belongs/caters to.'), |
a36434b9 | 371 | 'where' => 'civicrm_option_value.component_id', |
522a26c9 | 372 | 'table_name' => 'civicrm_option_value', |
373 | 'entity' => 'OptionValue', | |
374 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 375 | 'localizable' => 0, |
e501603b | 376 | 'FKClassName' => 'CRM_Core_DAO_Component', |
c3fc2621 | 377 | 'html' => [ |
e501603b | 378 | 'type' => 'Select', |
c3fc2621 CW |
379 | ], |
380 | 'pseudoconstant' => [ | |
e501603b TO |
381 | 'table' => 'civicrm_component', |
382 | 'keyColumn' => 'id', | |
383 | 'labelColumn' => 'name', | |
e6ca0a57 | 384 | ], |
c3fc2621 CW |
385 | ], |
386 | 'domain_id' => [ | |
e501603b TO |
387 | 'name' => 'domain_id', |
388 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 389 | 'title' => ts('Option Domain'), |
215b423e | 390 | 'description' => ts('Which Domain is this option value for'), |
a36434b9 | 391 | 'where' => 'civicrm_option_value.domain_id', |
522a26c9 | 392 | 'table_name' => 'civicrm_option_value', |
393 | 'entity' => 'OptionValue', | |
394 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 395 | 'localizable' => 0, |
e501603b | 396 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 397 | 'pseudoconstant' => [ |
e501603b TO |
398 | 'table' => 'civicrm_domain', |
399 | 'keyColumn' => 'id', | |
400 | 'labelColumn' => 'name', | |
e6ca0a57 | 401 | ], |
c3fc2621 CW |
402 | ], |
403 | 'visibility_id' => [ | |
e501603b TO |
404 | 'name' => 'visibility_id', |
405 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 406 | 'title' => ts('Option Visibility'), |
a36434b9 | 407 | 'where' => 'civicrm_option_value.visibility_id', |
e501603b | 408 | 'default' => 'NULL', |
522a26c9 | 409 | 'table_name' => 'civicrm_option_value', |
410 | 'entity' => 'OptionValue', | |
411 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 412 | 'localizable' => 0, |
e78e618d PN |
413 | 'pseudoconstant' => [ |
414 | 'optionGroupName' => 'visibility', | |
415 | 'optionEditPath' => 'civicrm/admin/options/visibility', | |
e6ca0a57 | 416 | ], |
c3fc2621 CW |
417 | ], |
418 | 'icon' => [ | |
b412f764 CW |
419 | 'name' => 'icon', |
420 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 421 | 'title' => ts('Icon'), |
215b423e | 422 | 'description' => ts('crm-i icon class'), |
b412f764 CW |
423 | 'maxlength' => 255, |
424 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 425 | 'where' => 'civicrm_option_value.icon', |
b412f764 | 426 | 'default' => 'NULL', |
522a26c9 | 427 | 'table_name' => 'civicrm_option_value', |
428 | 'entity' => 'OptionValue', | |
429 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 430 | 'localizable' => 0, |
c3fc2621 CW |
431 | ], |
432 | 'color' => [ | |
d73974ac CW |
433 | 'name' => 'color', |
434 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 435 | 'title' => ts('Color'), |
215b423e | 436 | 'description' => ts('Hex color value e.g. #ffffff'), |
d73974ac CW |
437 | 'maxlength' => 255, |
438 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 439 | 'where' => 'civicrm_option_value.color', |
d73974ac | 440 | 'default' => 'NULL', |
522a26c9 | 441 | 'table_name' => 'civicrm_option_value', |
442 | 'entity' => 'OptionValue', | |
443 | 'bao' => 'CRM_Core_BAO_OptionValue', | |
6a7e5e5d | 444 | 'localizable' => 0, |
c3fc2621 CW |
445 | ], |
446 | ]; | |
346aaaba | 447 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 448 | } |
346aaaba | 449 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 450 | } |
c3fc2621 | 451 | |
e501603b | 452 | /** |
bd8e0b14 | 453 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
454 | * |
455 | * @return array | |
bd8e0b14 | 456 | * Array(string $name => string $uniqueName). |
e501603b | 457 | */ |
c3fc2621 | 458 | public static function &fieldKeys() { |
bd8e0b14 TO |
459 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
460 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 461 | } |
bd8e0b14 | 462 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 463 | } |
c3fc2621 | 464 | |
e501603b TO |
465 | /** |
466 | * Returns the names of this table | |
467 | * | |
468 | * @return string | |
469 | */ | |
c3fc2621 | 470 | public static function getTableName() { |
e501603b TO |
471 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
472 | } | |
c3fc2621 | 473 | |
e501603b TO |
474 | /** |
475 | * Returns if this table needs to be logged | |
476 | * | |
c3fc2621 | 477 | * @return bool |
e501603b | 478 | */ |
c3fc2621 | 479 | public function getLog() { |
e501603b TO |
480 | return self::$_log; |
481 | } | |
c3fc2621 | 482 | |
e501603b TO |
483 | /** |
484 | * Returns the list of fields that can be imported | |
485 | * | |
486 | * @param bool $prefix | |
487 | * | |
488 | * @return array | |
489 | */ | |
c3fc2621 CW |
490 | public static function &import($prefix = FALSE) { |
491 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'option_value', $prefix, []); | |
60808919 | 492 | return $r; |
e501603b | 493 | } |
c3fc2621 | 494 | |
e501603b TO |
495 | /** |
496 | * Returns the list of fields that can be exported | |
497 | * | |
498 | * @param bool $prefix | |
499 | * | |
500 | * @return array | |
501 | */ | |
c3fc2621 CW |
502 | public static function &export($prefix = FALSE) { |
503 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'option_value', $prefix, []); | |
60808919 | 504 | return $r; |
e501603b | 505 | } |
c3fc2621 | 506 | |
e7a6b91a AS |
507 | /** |
508 | * Returns the list of indices | |
c3fc2621 CW |
509 | * |
510 | * @param bool $localize | |
511 | * | |
512 | * @return array | |
e7a6b91a AS |
513 | */ |
514 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
515 | $indices = [ |
516 | 'index_option_group_id_value' => [ | |
e7a6b91a | 517 | 'name' => 'index_option_group_id_value', |
c3fc2621 | 518 | 'field' => [ |
e7a6b91a AS |
519 | 0 => 'value(128)', |
520 | 1 => 'option_group_id', | |
c3fc2621 CW |
521 | ], |
522 | 'localizable' => FALSE, | |
e7a6b91a | 523 | 'sig' => 'civicrm_option_value::0::value(128)::option_group_id', |
c3fc2621 CW |
524 | ], |
525 | 'index_option_group_id_name' => [ | |
e7a6b91a | 526 | 'name' => 'index_option_group_id_name', |
c3fc2621 | 527 | 'field' => [ |
e7a6b91a AS |
528 | 0 => 'name(128)', |
529 | 1 => 'option_group_id', | |
c3fc2621 CW |
530 | ], |
531 | 'localizable' => FALSE, | |
e7a6b91a | 532 | 'sig' => 'civicrm_option_value::0::name(128)::option_group_id', |
c3fc2621 CW |
533 | ], |
534 | ]; | |
e7a6b91a AS |
535 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
536 | } | |
c3fc2621 | 537 | |
e501603b | 538 | } |