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