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