Merge pull request #13042 from jackrabbithanna/dev-core-475
[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:efbfbe95aac7abe98b31ab715965b57f)
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 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 static $_log = TRUE;
30
31 /**
32 * Unique table ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Which form does this field belong to.
40 *
41 * @var int unsigned
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 boolean
56 */
57 public $is_active;
58
59 /**
60 * the field is view only and not editable in user forms.
61 *
62 * @var boolean
63 */
64 public $is_view;
65
66 /**
67 * Is this field required when included in a user or registration form?
68 *
69 * @var boolean
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 boolean
105 */
106 public $in_selector;
107
108 /**
109 * Is this field included search form of profile?
110 *
111 * @var boolean
112 */
113 public $is_searchable;
114
115 /**
116 * Location type of this mapping, if required
117 *
118 * @var int unsigned
119 */
120 public $location_type_id;
121
122 /**
123 * Phone Type Id, if required
124 *
125 * @var int unsigned
126 */
127 public $phone_type_id;
128
129 /**
130 * Website Type Id, if required
131 *
132 * @var int unsigned
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 boolean
154 */
155 public $is_reserved;
156
157 /**
158 * Include in multi-record listing?
159 *
160 * @var boolean
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 'table_name' => 'civicrm_uf_field',
203 'entity' => 'UFField',
204 'bao' => 'CRM_Core_BAO_UFField',
205 'localizable' => 0,
206 ],
207 'uf_group_id' => [
208 'name' => 'uf_group_id',
209 'type' => CRM_Utils_Type::T_INT,
210 'title' => ts('Profile ID'),
211 'description' => ts('Which form does this field belong to.'),
212 'required' => TRUE,
213 'table_name' => 'civicrm_uf_field',
214 'entity' => 'UFField',
215 'bao' => 'CRM_Core_BAO_UFField',
216 'localizable' => 0,
217 'FKClassName' => 'CRM_Core_DAO_UFGroup',
218 'html' => [
219 'type' => 'Select',
220 ],
221 'pseudoconstant' => [
222 'table' => 'civicrm_uf_group',
223 'keyColumn' => 'id',
224 'labelColumn' => 'title',
225 ]
226 ],
227 'field_name' => [
228 'name' => 'field_name',
229 'type' => CRM_Utils_Type::T_STRING,
230 'title' => ts('Profile Field Name'),
231 'description' => ts('Name for CiviCRM field which is being exposed for sharing.'),
232 'required' => TRUE,
233 'maxlength' => 64,
234 'size' => CRM_Utils_Type::BIG,
235 'table_name' => 'civicrm_uf_field',
236 'entity' => 'UFField',
237 'bao' => 'CRM_Core_BAO_UFField',
238 'localizable' => 0,
239 ],
240 'is_active' => [
241 'name' => 'is_active',
242 'type' => CRM_Utils_Type::T_BOOLEAN,
243 'title' => ts('Profile Field Is Active'),
244 'description' => ts('Is this field currently shareable? If false, hide the field for all sharing contexts.'),
245 'default' => '1',
246 'table_name' => 'civicrm_uf_field',
247 'entity' => 'UFField',
248 'bao' => 'CRM_Core_BAO_UFField',
249 'localizable' => 0,
250 ],
251 'is_view' => [
252 'name' => 'is_view',
253 'type' => CRM_Utils_Type::T_BOOLEAN,
254 'title' => ts('Profile Is View Only'),
255 'description' => ts('the field is view only and not editable in user forms.'),
256 'default' => '0',
257 'table_name' => 'civicrm_uf_field',
258 'entity' => 'UFField',
259 'bao' => 'CRM_Core_BAO_UFField',
260 'localizable' => 0,
261 ],
262 'is_required' => [
263 'name' => 'is_required',
264 'type' => CRM_Utils_Type::T_BOOLEAN,
265 'title' => ts('Profile Field Is Required'),
266 'description' => ts('Is this field required when included in a user or registration form?'),
267 'default' => '0',
268 'table_name' => 'civicrm_uf_field',
269 'entity' => 'UFField',
270 'bao' => 'CRM_Core_BAO_UFField',
271 'localizable' => 0,
272 ],
273 'weight' => [
274 'name' => 'weight',
275 'type' => CRM_Utils_Type::T_INT,
276 'title' => ts('Order'),
277 'description' => ts('Controls field display order when user framework fields are displayed in registration and account editing forms.'),
278 'required' => TRUE,
279 'default' => '1',
280 'table_name' => 'civicrm_uf_field',
281 'entity' => 'UFField',
282 'bao' => 'CRM_Core_BAO_UFField',
283 'localizable' => 0,
284 ],
285 'help_post' => [
286 'name' => 'help_post',
287 'type' => CRM_Utils_Type::T_TEXT,
288 'title' => ts('Profile Field Post Help'),
289 'description' => ts('Description and/or help text to display after this field.'),
290 'table_name' => 'civicrm_uf_field',
291 'entity' => 'UFField',
292 'bao' => 'CRM_Core_BAO_UFField',
293 'localizable' => 1,
294 ],
295 'help_pre' => [
296 'name' => 'help_pre',
297 'type' => CRM_Utils_Type::T_TEXT,
298 'title' => ts('Profile Field Pre Help'),
299 'description' => ts('Description and/or help text to display before this field.'),
300 'table_name' => 'civicrm_uf_field',
301 'entity' => 'UFField',
302 'bao' => 'CRM_Core_BAO_UFField',
303 'localizable' => 1,
304 ],
305 'visibility' => [
306 'name' => 'visibility',
307 'type' => CRM_Utils_Type::T_STRING,
308 'title' => ts('Profile Field Visibility'),
309 'description' => ts('In what context(s) is this field visible.'),
310 'maxlength' => 32,
311 'size' => CRM_Utils_Type::MEDIUM,
312 'default' => 'User and User Admin Only',
313 'table_name' => 'civicrm_uf_field',
314 'entity' => 'UFField',
315 'bao' => 'CRM_Core_BAO_UFField',
316 'localizable' => 0,
317 'html' => [
318 'type' => 'Select',
319 ],
320 'pseudoconstant' => [
321 'callback' => 'CRM_Core_SelectValues::ufVisibility',
322 ]
323 ],
324 'in_selector' => [
325 'name' => 'in_selector',
326 'type' => CRM_Utils_Type::T_BOOLEAN,
327 'title' => ts('Profile Field Is a Filter'),
328 'description' => ts('Is this field included as a column in the selector table?'),
329 'default' => '0',
330 'table_name' => 'civicrm_uf_field',
331 'entity' => 'UFField',
332 'bao' => 'CRM_Core_BAO_UFField',
333 'localizable' => 0,
334 ],
335 'is_searchable' => [
336 'name' => 'is_searchable',
337 'type' => CRM_Utils_Type::T_BOOLEAN,
338 'title' => ts('Profile Field Is Searchable'),
339 'description' => ts('Is this field included search form of profile?'),
340 'default' => '0',
341 'table_name' => 'civicrm_uf_field',
342 'entity' => 'UFField',
343 'bao' => 'CRM_Core_BAO_UFField',
344 'localizable' => 0,
345 ],
346 'location_type_id' => [
347 'name' => 'location_type_id',
348 'type' => CRM_Utils_Type::T_INT,
349 'title' => ts('Profile Field Location Type'),
350 'description' => ts('Location type of this mapping, if required'),
351 'table_name' => 'civicrm_uf_field',
352 'entity' => 'UFField',
353 'bao' => 'CRM_Core_BAO_UFField',
354 'localizable' => 0,
355 'FKClassName' => 'CRM_Core_DAO_LocationType',
356 ],
357 'phone_type_id' => [
358 'name' => 'phone_type_id',
359 'type' => CRM_Utils_Type::T_INT,
360 'title' => ts('Profile Field Phone Type'),
361 'description' => ts('Phone Type Id, if required'),
362 'table_name' => 'civicrm_uf_field',
363 'entity' => 'UFField',
364 'bao' => 'CRM_Core_BAO_UFField',
365 'localizable' => 0,
366 'pseudoconstant' => [
367 'optionGroupName' => 'phone_type',
368 'optionEditPath' => 'civicrm/admin/options/phone_type',
369 ]
370 ],
371 'website_type_id' => [
372 'name' => 'website_type_id',
373 'type' => CRM_Utils_Type::T_INT,
374 'title' => ts('Profile Field Website Type'),
375 'description' => ts('Website Type Id, if required'),
376 'table_name' => 'civicrm_uf_field',
377 'entity' => 'UFField',
378 'bao' => 'CRM_Core_BAO_UFField',
379 'localizable' => 0,
380 'pseudoconstant' => [
381 'optionGroupName' => 'website_type',
382 'optionEditPath' => 'civicrm/admin/options/website_type',
383 ]
384 ],
385 'label' => [
386 'name' => 'label',
387 'type' => CRM_Utils_Type::T_STRING,
388 'title' => ts('Profile Field Label'),
389 'description' => ts('To save label for fields.'),
390 'required' => TRUE,
391 'maxlength' => 255,
392 'size' => CRM_Utils_Type::HUGE,
393 'table_name' => 'civicrm_uf_field',
394 'entity' => 'UFField',
395 'bao' => 'CRM_Core_BAO_UFField',
396 'localizable' => 1,
397 ],
398 'field_type' => [
399 'name' => 'field_type',
400 'type' => CRM_Utils_Type::T_STRING,
401 'title' => ts('Profile Field Type'),
402 'description' => ts('This field saves field type (ie individual,household.. field etc).'),
403 'maxlength' => 255,
404 'size' => CRM_Utils_Type::HUGE,
405 'table_name' => 'civicrm_uf_field',
406 'entity' => 'UFField',
407 'bao' => 'CRM_Core_BAO_UFField',
408 'localizable' => 0,
409 ],
410 'is_reserved' => [
411 'name' => 'is_reserved',
412 'type' => CRM_Utils_Type::T_BOOLEAN,
413 'title' => ts('Profile Field Is Reserved'),
414 'description' => ts('Is this field reserved for use by some other CiviCRM functionality?'),
415 'table_name' => 'civicrm_uf_field',
416 'entity' => 'UFField',
417 'bao' => 'CRM_Core_BAO_UFField',
418 'localizable' => 0,
419 ],
420 'is_multi_summary' => [
421 'name' => 'is_multi_summary',
422 'type' => CRM_Utils_Type::T_BOOLEAN,
423 'title' => ts('Profile Field Supports Multiple'),
424 'description' => ts('Include in multi-record listing?'),
425 'default' => '0',
426 'table_name' => 'civicrm_uf_field',
427 'entity' => 'UFField',
428 'bao' => 'CRM_Core_BAO_UFField',
429 'localizable' => 0,
430 ],
431 ];
432 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
433 }
434 return Civi::$statics[__CLASS__]['fields'];
435 }
436
437 /**
438 * Return a mapping from field-name to the corresponding key (as used in fields()).
439 *
440 * @return array
441 * Array(string $name => string $uniqueName).
442 */
443 public static function &fieldKeys() {
444 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
445 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
446 }
447 return Civi::$statics[__CLASS__]['fieldKeys'];
448 }
449
450 /**
451 * Returns the names of this table
452 *
453 * @return string
454 */
455 public static function getTableName() {
456 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
457 }
458
459 /**
460 * Returns if this table needs to be logged
461 *
462 * @return bool
463 */
464 public function getLog() {
465 return self::$_log;
466 }
467
468 /**
469 * Returns the list of fields that can be imported
470 *
471 * @param bool $prefix
472 *
473 * @return array
474 */
475 public static function &import($prefix = FALSE) {
476 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'uf_field', $prefix, []);
477 return $r;
478 }
479
480 /**
481 * Returns the list of fields that can be exported
482 *
483 * @param bool $prefix
484 *
485 * @return array
486 */
487 public static function &export($prefix = FALSE) {
488 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'uf_field', $prefix, []);
489 return $r;
490 }
491
492 /**
493 * Returns the list of indices
494 *
495 * @param bool $localize
496 *
497 * @return array
498 */
499 public static function indices($localize = TRUE) {
500 $indices = [
501 'IX_website_type_id' => [
502 'name' => 'IX_website_type_id',
503 'field' => [
504 0 => 'website_type_id',
505 ],
506 'localizable' => FALSE,
507 'sig' => 'civicrm_uf_field::0::website_type_id',
508 ],
509 ];
510 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
511 }
512
513 }