Merge pull request #15415 from ixiam/dev_issue#1297
[civicrm-core.git] / CRM / Core / DAO / UFField.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/UFField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:100fb17dc7c4289eab137e5d7dc4e71c)
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 foreign keys and entity references.
174 *
175 * @return array
176 * [CRM_Core_Reference_Interface]
177 */
178 public static function getReferenceColumns() {
179 if (!isset(Civi::$statics[__CLASS__]['links'])) {
180 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
181 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'uf_group_id', 'civicrm_uf_group', 'id');
182 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'location_type_id', 'civicrm_location_type', 'id');
183 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
184 }
185 return Civi::$statics[__CLASS__]['links'];
186 }
187
188 /**
189 * Returns all the column names of this table
190 *
191 * @return array
192 */
193 public static function &fields() {
194 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
195 Civi::$statics[__CLASS__]['fields'] = [
196 'id' => [
197 'name' => 'id',
198 'type' => CRM_Utils_Type::T_INT,
199 'title' => ts('Profile Field ID'),
200 'description' => ts('Unique table ID'),
201 'required' => TRUE,
202 'where' => 'civicrm_uf_field.id',
203 'table_name' => 'civicrm_uf_field',
204 'entity' => 'UFField',
205 'bao' => 'CRM_Core_BAO_UFField',
206 'localizable' => 0,
207 ],
208 'uf_group_id' => [
209 'name' => 'uf_group_id',
210 'type' => CRM_Utils_Type::T_INT,
211 'title' => ts('Profile ID'),
212 'description' => ts('Which form does this field belong to.'),
213 'required' => TRUE,
214 'where' => 'civicrm_uf_field.uf_group_id',
215 'table_name' => 'civicrm_uf_field',
216 'entity' => 'UFField',
217 'bao' => 'CRM_Core_BAO_UFField',
218 'localizable' => 0,
219 'FKClassName' => 'CRM_Core_DAO_UFGroup',
220 'html' => [
221 'type' => 'Select',
222 ],
223 'pseudoconstant' => [
224 'table' => 'civicrm_uf_group',
225 'keyColumn' => 'id',
226 'labelColumn' => 'title',
227 ],
228 ],
229 'field_name' => [
230 'name' => 'field_name',
231 'type' => CRM_Utils_Type::T_STRING,
232 'title' => ts('Profile Field Name'),
233 'description' => ts('Name for CiviCRM field which is being exposed for sharing.'),
234 'required' => TRUE,
235 'maxlength' => 64,
236 'size' => CRM_Utils_Type::BIG,
237 'where' => 'civicrm_uf_field.field_name',
238 'table_name' => 'civicrm_uf_field',
239 'entity' => 'UFField',
240 'bao' => 'CRM_Core_BAO_UFField',
241 'localizable' => 0,
242 'pseudoconstant' => [
243 'callback' => 'CRM_Core_BAO_UFField::getAvailableFieldTitles',
244 ],
245 ],
246 'is_active' => [
247 'name' => 'is_active',
248 'type' => CRM_Utils_Type::T_BOOLEAN,
249 'title' => ts('Profile Field Is Active'),
250 'description' => ts('Is this field currently shareable? If false, hide the field for all sharing contexts.'),
251 'where' => 'civicrm_uf_field.is_active',
252 'default' => '1',
253 'table_name' => 'civicrm_uf_field',
254 'entity' => 'UFField',
255 'bao' => 'CRM_Core_BAO_UFField',
256 'localizable' => 0,
257 ],
258 'is_view' => [
259 'name' => 'is_view',
260 'type' => CRM_Utils_Type::T_BOOLEAN,
261 'title' => ts('Profile Is View Only'),
262 'description' => ts('the field is view only and not editable in user forms.'),
263 'where' => 'civicrm_uf_field.is_view',
264 'default' => '0',
265 'table_name' => 'civicrm_uf_field',
266 'entity' => 'UFField',
267 'bao' => 'CRM_Core_BAO_UFField',
268 'localizable' => 0,
269 ],
270 'is_required' => [
271 'name' => 'is_required',
272 'type' => CRM_Utils_Type::T_BOOLEAN,
273 'title' => ts('Profile Field Is Required'),
274 'description' => ts('Is this field required when included in a user or registration form?'),
275 'where' => 'civicrm_uf_field.is_required',
276 'default' => '0',
277 'table_name' => 'civicrm_uf_field',
278 'entity' => 'UFField',
279 'bao' => 'CRM_Core_BAO_UFField',
280 'localizable' => 0,
281 ],
282 'weight' => [
283 'name' => 'weight',
284 'type' => CRM_Utils_Type::T_INT,
285 'title' => ts('Order'),
286 'description' => ts('Controls field display order when user framework fields are displayed in registration and account editing forms.'),
287 'required' => TRUE,
288 'where' => 'civicrm_uf_field.weight',
289 'default' => '1',
290 'table_name' => 'civicrm_uf_field',
291 'entity' => 'UFField',
292 'bao' => 'CRM_Core_BAO_UFField',
293 'localizable' => 0,
294 ],
295 'help_post' => [
296 'name' => 'help_post',
297 'type' => CRM_Utils_Type::T_TEXT,
298 'title' => ts('Profile Field Post Help'),
299 'description' => ts('Description and/or help text to display after this field.'),
300 'where' => 'civicrm_uf_field.help_post',
301 'table_name' => 'civicrm_uf_field',
302 'entity' => 'UFField',
303 'bao' => 'CRM_Core_BAO_UFField',
304 'localizable' => 1,
305 ],
306 'help_pre' => [
307 'name' => 'help_pre',
308 'type' => CRM_Utils_Type::T_TEXT,
309 'title' => ts('Profile Field Pre Help'),
310 'description' => ts('Description and/or help text to display before this field.'),
311 'where' => 'civicrm_uf_field.help_pre',
312 'table_name' => 'civicrm_uf_field',
313 'entity' => 'UFField',
314 'bao' => 'CRM_Core_BAO_UFField',
315 'localizable' => 1,
316 ],
317 'visibility' => [
318 'name' => 'visibility',
319 'type' => CRM_Utils_Type::T_STRING,
320 'title' => ts('Profile Field Visibility'),
321 'description' => ts('In what context(s) is this field visible.'),
322 'maxlength' => 32,
323 'size' => CRM_Utils_Type::MEDIUM,
324 'where' => 'civicrm_uf_field.visibility',
325 'default' => 'User and User Admin Only',
326 'table_name' => 'civicrm_uf_field',
327 'entity' => 'UFField',
328 'bao' => 'CRM_Core_BAO_UFField',
329 'localizable' => 0,
330 'html' => [
331 'type' => 'Select',
332 ],
333 'pseudoconstant' => [
334 'callback' => 'CRM_Core_SelectValues::ufVisibility',
335 ],
336 ],
337 'in_selector' => [
338 'name' => 'in_selector',
339 'type' => CRM_Utils_Type::T_BOOLEAN,
340 'title' => ts('Profile Field Is a Filter'),
341 'description' => ts('Is this field included as a column in the selector table?'),
342 'where' => 'civicrm_uf_field.in_selector',
343 'default' => '0',
344 'table_name' => 'civicrm_uf_field',
345 'entity' => 'UFField',
346 'bao' => 'CRM_Core_BAO_UFField',
347 'localizable' => 0,
348 ],
349 'is_searchable' => [
350 'name' => 'is_searchable',
351 'type' => CRM_Utils_Type::T_BOOLEAN,
352 'title' => ts('Profile Field Is Searchable'),
353 'description' => ts('Is this field included search form of profile?'),
354 'where' => 'civicrm_uf_field.is_searchable',
355 'default' => '0',
356 'table_name' => 'civicrm_uf_field',
357 'entity' => 'UFField',
358 'bao' => 'CRM_Core_BAO_UFField',
359 'localizable' => 0,
360 ],
361 'location_type_id' => [
362 'name' => 'location_type_id',
363 'type' => CRM_Utils_Type::T_INT,
364 'title' => ts('Profile Field Location Type'),
365 'description' => ts('Location type of this mapping, if required'),
366 'where' => 'civicrm_uf_field.location_type_id',
367 'table_name' => 'civicrm_uf_field',
368 'entity' => 'UFField',
369 'bao' => 'CRM_Core_BAO_UFField',
370 'localizable' => 0,
371 'FKClassName' => 'CRM_Core_DAO_LocationType',
372 ],
373 'phone_type_id' => [
374 'name' => 'phone_type_id',
375 'type' => CRM_Utils_Type::T_INT,
376 'title' => ts('Profile Field Phone Type'),
377 'description' => ts('Phone Type Id, if required'),
378 'where' => 'civicrm_uf_field.phone_type_id',
379 'table_name' => 'civicrm_uf_field',
380 'entity' => 'UFField',
381 'bao' => 'CRM_Core_BAO_UFField',
382 'localizable' => 0,
383 'pseudoconstant' => [
384 'optionGroupName' => 'phone_type',
385 'optionEditPath' => 'civicrm/admin/options/phone_type',
386 ],
387 ],
388 'website_type_id' => [
389 'name' => 'website_type_id',
390 'type' => CRM_Utils_Type::T_INT,
391 'title' => ts('Profile Field Website Type'),
392 'description' => ts('Website Type Id, if required'),
393 'where' => 'civicrm_uf_field.website_type_id',
394 'table_name' => 'civicrm_uf_field',
395 'entity' => 'UFField',
396 'bao' => 'CRM_Core_BAO_UFField',
397 'localizable' => 0,
398 'pseudoconstant' => [
399 'optionGroupName' => 'website_type',
400 'optionEditPath' => 'civicrm/admin/options/website_type',
401 ],
402 ],
403 'label' => [
404 'name' => 'label',
405 'type' => CRM_Utils_Type::T_STRING,
406 'title' => ts('Profile Field Label'),
407 'description' => ts('To save label for fields.'),
408 'required' => TRUE,
409 'maxlength' => 255,
410 'size' => CRM_Utils_Type::HUGE,
411 'where' => 'civicrm_uf_field.label',
412 'table_name' => 'civicrm_uf_field',
413 'entity' => 'UFField',
414 'bao' => 'CRM_Core_BAO_UFField',
415 'localizable' => 1,
416 ],
417 'field_type' => [
418 'name' => 'field_type',
419 'type' => CRM_Utils_Type::T_STRING,
420 'title' => ts('Profile Field Type'),
421 'description' => ts('This field saves field type (ie individual,household.. field etc).'),
422 'maxlength' => 255,
423 'size' => CRM_Utils_Type::HUGE,
424 'where' => 'civicrm_uf_field.field_type',
425 'table_name' => 'civicrm_uf_field',
426 'entity' => 'UFField',
427 'bao' => 'CRM_Core_BAO_UFField',
428 'localizable' => 0,
429 ],
430 'is_reserved' => [
431 'name' => 'is_reserved',
432 'type' => CRM_Utils_Type::T_BOOLEAN,
433 'title' => ts('Profile Field Is Reserved'),
434 'description' => ts('Is this field reserved for use by some other CiviCRM functionality?'),
435 'where' => 'civicrm_uf_field.is_reserved',
436 'table_name' => 'civicrm_uf_field',
437 'entity' => 'UFField',
438 'bao' => 'CRM_Core_BAO_UFField',
439 'localizable' => 0,
440 ],
441 'is_multi_summary' => [
442 'name' => 'is_multi_summary',
443 'type' => CRM_Utils_Type::T_BOOLEAN,
444 'title' => ts('Profile Field Supports Multiple'),
445 'description' => ts('Include in multi-record listing?'),
446 'where' => 'civicrm_uf_field.is_multi_summary',
447 'default' => '0',
448 'table_name' => 'civicrm_uf_field',
449 'entity' => 'UFField',
450 'bao' => 'CRM_Core_BAO_UFField',
451 'localizable' => 0,
452 ],
453 ];
454 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
455 }
456 return Civi::$statics[__CLASS__]['fields'];
457 }
458
459 /**
460 * Return a mapping from field-name to the corresponding key (as used in fields()).
461 *
462 * @return array
463 * Array(string $name => string $uniqueName).
464 */
465 public static function &fieldKeys() {
466 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
467 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
468 }
469 return Civi::$statics[__CLASS__]['fieldKeys'];
470 }
471
472 /**
473 * Returns the names of this table
474 *
475 * @return string
476 */
477 public static function getTableName() {
478 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
479 }
480
481 /**
482 * Returns if this table needs to be logged
483 *
484 * @return bool
485 */
486 public function getLog() {
487 return self::$_log;
488 }
489
490 /**
491 * Returns the list of fields that can be imported
492 *
493 * @param bool $prefix
494 *
495 * @return array
496 */
497 public static function &import($prefix = FALSE) {
498 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, []);
499 return $r;
500 }
501
502 /**
503 * Returns the list of fields that can be exported
504 *
505 * @param bool $prefix
506 *
507 * @return array
508 */
509 public static function &export($prefix = FALSE) {
510 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, []);
511 return $r;
512 }
513
514 /**
515 * Returns the list of indices
516 *
517 * @param bool $localize
518 *
519 * @return array
520 */
521 public static function indices($localize = TRUE) {
522 $indices = [
523 'IX_website_type_id' => [
524 'name' => 'IX_website_type_id',
525 'field' => [
526 0 => 'website_type_id',
527 ],
528 'localizable' => FALSE,
529 'sig' => 'civicrm_uf_field::0::website_type_id',
530 ],
531 ];
532 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
533 }
534
535 }