API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Core / DAO / UFField.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/UFField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a77a2bfe4b288e20b6929fd3a7532850)
10 */
11
12 /**
13 * Database access object for the UFField entity.
14 */
15 class CRM_Core_DAO_UFField extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_uf_field';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = TRUE;
30
31 /**
32 * Unique table ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Which form does this field belong to.
40 *
41 * @var int
42 */
43 public $uf_group_id;
44
45 /**
46 * Name for CiviCRM field which is being exposed for sharing.
47 *
48 * @var string
49 */
50 public $field_name;
51
52 /**
53 * Is this field currently shareable? If false, hide the field for all sharing contexts.
54 *
55 * @var bool
56 */
57 public $is_active;
58
59 /**
60 * the field is view only and not editable in user forms.
61 *
62 * @var bool
63 */
64 public $is_view;
65
66 /**
67 * Is this field required when included in a user or registration form?
68 *
69 * @var bool
70 */
71 public $is_required;
72
73 /**
74 * Controls field display order when user framework fields are displayed in registration and account editing forms.
75 *
76 * @var int
77 */
78 public $weight;
79
80 /**
81 * Description and/or help text to display after this field.
82 *
83 * @var text
84 */
85 public $help_post;
86
87 /**
88 * Description and/or help text to display before this field.
89 *
90 * @var text
91 */
92 public $help_pre;
93
94 /**
95 * In what context(s) is this field visible.
96 *
97 * @var string
98 */
99 public $visibility;
100
101 /**
102 * Is this field included as a column in the selector table?
103 *
104 * @var bool
105 */
106 public $in_selector;
107
108 /**
109 * Is this field included search form of profile?
110 *
111 * @var bool
112 */
113 public $is_searchable;
114
115 /**
116 * Location type of this mapping, if required
117 *
118 * @var int
119 */
120 public $location_type_id;
121
122 /**
123 * Phone Type Id, if required
124 *
125 * @var int
126 */
127 public $phone_type_id;
128
129 /**
130 * Website Type Id, if required
131 *
132 * @var int
133 */
134 public $website_type_id;
135
136 /**
137 * To save label for fields.
138 *
139 * @var string
140 */
141 public $label;
142
143 /**
144 * This field saves field type (ie individual,household.. field etc).
145 *
146 * @var string
147 */
148 public $field_type;
149
150 /**
151 * Is this field reserved for use by some other CiviCRM functionality?
152 *
153 * @var bool
154 */
155 public $is_reserved;
156
157 /**
158 * Include in multi-record listing?
159 *
160 * @var bool
161 */
162 public $is_multi_summary;
163
164 /**
165 * Class constructor.
166 */
167 public function __construct() {
168 $this->__table = 'civicrm_uf_field';
169 parent::__construct();
170 }
171
172 /**
173 * Returns localized title of this entity.
174 */
175 public static function getEntityTitle() {
176 return ts('UFFields');
177 }
178
179 /**
180 * Returns foreign keys and entity references.
181 *
182 * @return array
183 * [CRM_Core_Reference_Interface]
184 */
185 public static function getReferenceColumns() {
186 if (!isset(Civi::$statics[__CLASS__]['links'])) {
187 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
188 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'uf_group_id', 'civicrm_uf_group', 'id');
189 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
190 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
191 }
192 return Civi::$statics[__CLASS__]['links'];
193 }
194
195 /**
196 * Returns all the column names of this table
197 *
198 * @return array
199 */
200 public static function &fields() {
201 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
202 Civi::$statics[__CLASS__]['fields'] = [
203 'id' => [
204 'name' => 'id',
205 'type' => CRM_Utils_Type::T_INT,
206 'title' => ts('Profile Field ID'),
207 'description' => ts('Unique table ID'),
208 'required' => TRUE,
209 'where' => 'civicrm_uf_field.id',
210 'table_name' => 'civicrm_uf_field',
211 'entity' => 'UFField',
212 'bao' => 'CRM_Core_BAO_UFField',
213 'localizable' => 0,
214 'add' => '1.1',
215 ],
216 'uf_group_id' => [
217 'name' => 'uf_group_id',
218 'type' => CRM_Utils_Type::T_INT,
219 'title' => ts('Profile ID'),
220 'description' => ts('Which form does this field belong to.'),
221 'required' => TRUE,
222 'where' => 'civicrm_uf_field.uf_group_id',
223 'table_name' => 'civicrm_uf_field',
224 'entity' => 'UFField',
225 'bao' => 'CRM_Core_BAO_UFField',
226 'localizable' => 0,
227 'FKClassName' => 'CRM_Core_DAO_UFGroup',
228 'html' => [
229 'type' => 'Select',
230 ],
231 'pseudoconstant' => [
232 'table' => 'civicrm_uf_group',
233 'keyColumn' => 'id',
234 'labelColumn' => 'title',
235 ],
236 'add' => '1.1',
237 ],
238 'field_name' => [
239 'name' => 'field_name',
240 'type' => CRM_Utils_Type::T_STRING,
241 'title' => ts('Profile Field Name'),
242 'description' => ts('Name for CiviCRM field which is being exposed for sharing.'),
243 'required' => TRUE,
244 'maxlength' => 64,
245 'size' => CRM_Utils_Type::BIG,
246 'where' => 'civicrm_uf_field.field_name',
247 'table_name' => 'civicrm_uf_field',
248 'entity' => 'UFField',
249 'bao' => 'CRM_Core_BAO_UFField',
250 'localizable' => 0,
251 'pseudoconstant' => [
252 'callback' => 'CRM_Core_BAO_UFField::getAvailableFieldTitles',
253 ],
254 'add' => '1.1',
255 ],
256 'is_active' => [
257 'name' => 'is_active',
258 'type' => CRM_Utils_Type::T_BOOLEAN,
259 'title' => ts('Profile Field Is Active'),
260 'description' => ts('Is this field currently shareable? If false, hide the field for all sharing contexts.'),
261 'where' => 'civicrm_uf_field.is_active',
262 'default' => '1',
263 'table_name' => 'civicrm_uf_field',
264 'entity' => 'UFField',
265 'bao' => 'CRM_Core_BAO_UFField',
266 'localizable' => 0,
267 'add' => '1.1',
268 ],
269 'is_view' => [
270 'name' => 'is_view',
271 'type' => CRM_Utils_Type::T_BOOLEAN,
272 'title' => ts('Profile Is View Only'),
273 'description' => ts('the field is view only and not editable in user forms.'),
274 'where' => 'civicrm_uf_field.is_view',
275 'default' => '0',
276 'table_name' => 'civicrm_uf_field',
277 'entity' => 'UFField',
278 'bao' => 'CRM_Core_BAO_UFField',
279 'localizable' => 0,
280 'add' => '1.1',
281 ],
282 'is_required' => [
283 'name' => 'is_required',
284 'type' => CRM_Utils_Type::T_BOOLEAN,
285 'title' => ts('Profile Field Is Required'),
286 'description' => ts('Is this field required when included in a user or registration form?'),
287 'where' => 'civicrm_uf_field.is_required',
288 'default' => '0',
289 'table_name' => 'civicrm_uf_field',
290 'entity' => 'UFField',
291 'bao' => 'CRM_Core_BAO_UFField',
292 'localizable' => 0,
293 'add' => '1.1',
294 ],
295 'weight' => [
296 'name' => 'weight',
297 'type' => CRM_Utils_Type::T_INT,
298 'title' => ts('Order'),
299 'description' => ts('Controls field display order when user framework fields are displayed in registration and account editing forms.'),
300 'required' => TRUE,
301 'where' => 'civicrm_uf_field.weight',
302 'default' => '1',
303 'table_name' => 'civicrm_uf_field',
304 'entity' => 'UFField',
305 'bao' => 'CRM_Core_BAO_UFField',
306 'localizable' => 0,
307 'add' => '1.1',
308 ],
309 'help_post' => [
310 'name' => 'help_post',
311 'type' => CRM_Utils_Type::T_TEXT,
312 'title' => ts('Profile Field Post Help'),
313 'description' => ts('Description and/or help text to display after this field.'),
314 'where' => 'civicrm_uf_field.help_post',
315 'table_name' => 'civicrm_uf_field',
316 'entity' => 'UFField',
317 'bao' => 'CRM_Core_BAO_UFField',
318 'localizable' => 1,
319 'add' => '1.1',
320 ],
321 'help_pre' => [
322 'name' => 'help_pre',
323 'type' => CRM_Utils_Type::T_TEXT,
324 'title' => ts('Profile Field Pre Help'),
325 'description' => ts('Description and/or help text to display before this field.'),
326 'where' => 'civicrm_uf_field.help_pre',
327 'table_name' => 'civicrm_uf_field',
328 'entity' => 'UFField',
329 'bao' => 'CRM_Core_BAO_UFField',
330 'localizable' => 1,
331 'add' => '3.2',
332 ],
333 'visibility' => [
334 'name' => 'visibility',
335 'type' => CRM_Utils_Type::T_STRING,
336 'title' => ts('Profile Field Visibility'),
337 'description' => ts('In what context(s) is this field visible.'),
338 'maxlength' => 32,
339 'size' => CRM_Utils_Type::MEDIUM,
340 'where' => 'civicrm_uf_field.visibility',
341 'default' => 'User and User Admin Only',
342 'table_name' => 'civicrm_uf_field',
343 'entity' => 'UFField',
344 'bao' => 'CRM_Core_BAO_UFField',
345 'localizable' => 0,
346 'html' => [
347 'type' => 'Select',
348 ],
349 'pseudoconstant' => [
350 'callback' => 'CRM_Core_SelectValues::ufVisibility',
351 ],
352 'add' => '1.1',
353 ],
354 'in_selector' => [
355 'name' => 'in_selector',
356 'type' => CRM_Utils_Type::T_BOOLEAN,
357 'title' => ts('Profile Field Is a Filter'),
358 'description' => ts('Is this field included as a column in the selector table?'),
359 'where' => 'civicrm_uf_field.in_selector',
360 'default' => '0',
361 'table_name' => 'civicrm_uf_field',
362 'entity' => 'UFField',
363 'bao' => 'CRM_Core_BAO_UFField',
364 'localizable' => 0,
365 'add' => '1.2',
366 ],
367 'is_searchable' => [
368 'name' => 'is_searchable',
369 'type' => CRM_Utils_Type::T_BOOLEAN,
370 'title' => ts('Profile Field Is Searchable'),
371 'description' => ts('Is this field included search form of profile?'),
372 'where' => 'civicrm_uf_field.is_searchable',
373 'default' => '0',
374 'table_name' => 'civicrm_uf_field',
375 'entity' => 'UFField',
376 'bao' => 'CRM_Core_BAO_UFField',
377 'localizable' => 0,
378 'add' => '1.4',
379 ],
380 'location_type_id' => [
381 'name' => 'location_type_id',
382 'type' => CRM_Utils_Type::T_INT,
383 'title' => ts('Profile Field Location Type'),
384 'description' => ts('Location type of this mapping, if required'),
385 'where' => 'civicrm_uf_field.location_type_id',
386 'table_name' => 'civicrm_uf_field',
387 'entity' => 'UFField',
388 'bao' => 'CRM_Core_BAO_UFField',
389 'localizable' => 0,
390 'FKClassName' => 'CRM_Core_DAO_LocationType',
391 'add' => '1.3',
392 ],
393 'phone_type_id' => [
394 'name' => 'phone_type_id',
395 'type' => CRM_Utils_Type::T_INT,
396 'title' => ts('Profile Field Phone Type'),
397 'description' => ts('Phone Type Id, if required'),
398 'where' => 'civicrm_uf_field.phone_type_id',
399 'table_name' => 'civicrm_uf_field',
400 'entity' => 'UFField',
401 'bao' => 'CRM_Core_BAO_UFField',
402 'localizable' => 0,
403 'pseudoconstant' => [
404 'optionGroupName' => 'phone_type',
405 'optionEditPath' => 'civicrm/admin/options/phone_type',
406 ],
407 'add' => '2.2',
408 ],
409 'website_type_id' => [
410 'name' => 'website_type_id',
411 'type' => CRM_Utils_Type::T_INT,
412 'title' => ts('Profile Field Website Type'),
413 'description' => ts('Website Type Id, if required'),
414 'where' => 'civicrm_uf_field.website_type_id',
415 'table_name' => 'civicrm_uf_field',
416 'entity' => 'UFField',
417 'bao' => 'CRM_Core_BAO_UFField',
418 'localizable' => 0,
419 'pseudoconstant' => [
420 'optionGroupName' => 'website_type',
421 'optionEditPath' => 'civicrm/admin/options/website_type',
422 ],
423 'add' => '4.5',
424 ],
425 'label' => [
426 'name' => 'label',
427 'type' => CRM_Utils_Type::T_STRING,
428 'title' => ts('Profile Field Label'),
429 'description' => ts('To save label for fields.'),
430 'required' => TRUE,
431 'maxlength' => 255,
432 'size' => CRM_Utils_Type::HUGE,
433 'where' => 'civicrm_uf_field.label',
434 'table_name' => 'civicrm_uf_field',
435 'entity' => 'UFField',
436 'bao' => 'CRM_Core_BAO_UFField',
437 'localizable' => 1,
438 'add' => '1.4',
439 ],
440 'field_type' => [
441 'name' => 'field_type',
442 'type' => CRM_Utils_Type::T_STRING,
443 'title' => ts('Profile Field Type'),
444 'description' => ts('This field saves field type (ie individual,household.. field etc).'),
445 'maxlength' => 255,
446 'size' => CRM_Utils_Type::HUGE,
447 'where' => 'civicrm_uf_field.field_type',
448 'table_name' => 'civicrm_uf_field',
449 'entity' => 'UFField',
450 'bao' => 'CRM_Core_BAO_UFField',
451 'localizable' => 0,
452 'add' => '1.4',
453 ],
454 'is_reserved' => [
455 'name' => 'is_reserved',
456 'type' => CRM_Utils_Type::T_BOOLEAN,
457 'title' => ts('Profile Field Is Reserved'),
458 'description' => ts('Is this field reserved for use by some other CiviCRM functionality?'),
459 'where' => 'civicrm_uf_field.is_reserved',
460 'table_name' => 'civicrm_uf_field',
461 'entity' => 'UFField',
462 'bao' => 'CRM_Core_BAO_UFField',
463 'localizable' => 0,
464 'add' => '3.0',
465 ],
466 'is_multi_summary' => [
467 'name' => 'is_multi_summary',
468 'type' => CRM_Utils_Type::T_BOOLEAN,
469 'title' => ts('Profile Field Supports Multiple'),
470 'description' => ts('Include in multi-record listing?'),
471 'where' => 'civicrm_uf_field.is_multi_summary',
472 'default' => '0',
473 'table_name' => 'civicrm_uf_field',
474 'entity' => 'UFField',
475 'bao' => 'CRM_Core_BAO_UFField',
476 'localizable' => 0,
477 'add' => '4.3',
478 ],
479 ];
480 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
481 }
482 return Civi::$statics[__CLASS__]['fields'];
483 }
484
485 /**
486 * Return a mapping from field-name to the corresponding key (as used in fields()).
487 *
488 * @return array
489 * Array(string $name => string $uniqueName).
490 */
491 public static function &fieldKeys() {
492 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
493 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
494 }
495 return Civi::$statics[__CLASS__]['fieldKeys'];
496 }
497
498 /**
499 * Returns the names of this table
500 *
501 * @return string
502 */
503 public static function getTableName() {
504 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
505 }
506
507 /**
508 * Returns if this table needs to be logged
509 *
510 * @return bool
511 */
512 public function getLog() {
513 return self::$_log;
514 }
515
516 /**
517 * Returns the list of fields that can be imported
518 *
519 * @param bool $prefix
520 *
521 * @return array
522 */
523 public static function &import($prefix = FALSE) {
524 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, []);
525 return $r;
526 }
527
528 /**
529 * Returns the list of fields that can be exported
530 *
531 * @param bool $prefix
532 *
533 * @return array
534 */
535 public static function &export($prefix = FALSE) {
536 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, []);
537 return $r;
538 }
539
540 /**
541 * Returns the list of indices
542 *
543 * @param bool $localize
544 *
545 * @return array
546 */
547 public static function indices($localize = TRUE) {
548 $indices = [
549 'IX_website_type_id' => [
550 'name' => 'IX_website_type_id',
551 'field' => [
552 0 => 'website_type_id',
553 ],
554 'localizable' => FALSE,
555 'sig' => 'civicrm_uf_field::0::website_type_id',
556 ],
557 ];
558 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
559 }
560
561 }