5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/UFField.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4d8ac7c59b6f2301cc22fe7966e8fc91)
13 * Database access object for the UFField entity.
15 class CRM_Core_DAO_UFField
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_uf_field';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Which form does this field belong to.
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
52 * Name for CiviCRM field which is being exposed for sharing.
55 * (SQL type: varchar(64))
56 * Note that values will be retrieved from the database as a string.
61 * Is this field currently shareable? If false, hide the field for all sharing contexts.
65 * Note that values will be retrieved from the database as a string.
70 * the field is view only and not editable in user forms.
74 * Note that values will be retrieved from the database as a string.
79 * Is this field required when included in a user or registration form?
83 * Note that values will be retrieved from the database as a string.
88 * Controls field display order when user framework fields are displayed in registration and account editing forms.
92 * Note that values will be retrieved from the database as a string.
97 * Description and/or help text to display after this field.
101 * Note that values will be retrieved from the database as a string.
106 * Description and/or help text to display before this field.
110 * Note that values will be retrieved from the database as a string.
115 * In what context(s) is this field visible.
118 * (SQL type: varchar(32))
119 * Note that values will be retrieved from the database as a string.
124 * Is this field included as a column in the selector table?
127 * (SQL type: tinyint)
128 * Note that values will be retrieved from the database as a string.
133 * Is this field included search form of profile?
136 * (SQL type: tinyint)
137 * Note that values will be retrieved from the database as a string.
139 public $is_searchable;
142 * Location type of this mapping, if required
144 * @var int|string|null
145 * (SQL type: int unsigned)
146 * Note that values will be retrieved from the database as a string.
148 public $location_type_id;
151 * Phone Type ID, if required
153 * @var int|string|null
154 * (SQL type: int unsigned)
155 * Note that values will be retrieved from the database as a string.
157 public $phone_type_id;
160 * Website Type ID, if required
162 * @var int|string|null
163 * (SQL type: int unsigned)
164 * Note that values will be retrieved from the database as a string.
166 public $website_type_id;
169 * To save label for fields.
172 * (SQL type: varchar(255))
173 * Note that values will be retrieved from the database as a string.
178 * This field saves field type (ie individual,household.. field etc).
181 * (SQL type: varchar(255))
182 * Note that values will be retrieved from the database as a string.
187 * Is this field reserved for use by some other CiviCRM functionality?
190 * (SQL type: tinyint)
191 * Note that values will be retrieved from the database as a string.
196 * Include in multi-record listing?
199 * (SQL type: tinyint)
200 * Note that values will be retrieved from the database as a string.
202 public $is_multi_summary;
207 public function __construct() {
208 $this->__table
= 'civicrm_uf_field';
209 parent
::__construct();
213 * Returns localized title of this entity.
215 * @param bool $plural
216 * Whether to return the plural version of the title.
218 public static function getEntityTitle($plural = FALSE) {
219 return $plural ?
ts('UFFields') : ts('UFField');
223 * Returns foreign keys and entity references.
226 * [CRM_Core_Reference_Interface]
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']);
235 return Civi
::$statics[__CLASS__
]['links'];
239 * Returns all the column names of this table
243 public static function &fields() {
244 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
245 Civi
::$statics[__CLASS__
]['fields'] = [
248 'type' => CRM_Utils_Type
::T_INT
,
249 'title' => ts('Profile Field ID'),
250 'description' => ts('Unique table ID'),
252 'where' => 'civicrm_uf_field.id',
253 'table_name' => 'civicrm_uf_field',
254 'entity' => 'UFField',
255 'bao' => 'CRM_Core_BAO_UFField',
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.'),
269 'where' => 'civicrm_uf_field.uf_group_id',
270 'table_name' => 'civicrm_uf_field',
271 'entity' => 'UFField',
272 'bao' => 'CRM_Core_BAO_UFField',
274 'FKClassName' => 'CRM_Core_DAO_UFGroup',
277 'label' => ts("Profile"),
279 'pseudoconstant' => [
280 'table' => 'civicrm_uf_group',
282 'labelColumn' => 'title',
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.'),
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',
299 'pseudoconstant' => [
300 'callback' => 'CRM_Core_BAO_UFField::getAvailableFieldTitles',
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.'),
310 'where' => 'civicrm_uf_field.is_active',
312 'table_name' => 'civicrm_uf_field',
313 'entity' => 'UFField',
314 'bao' => 'CRM_Core_BAO_UFField',
320 'type' => CRM_Utils_Type
::T_BOOLEAN
,
321 'title' => ts('Profile Is View Only'),
322 'description' => ts('the field is view only and not editable in user forms.'),
324 'where' => 'civicrm_uf_field.is_view',
326 'table_name' => 'civicrm_uf_field',
327 'entity' => 'UFField',
328 'bao' => 'CRM_Core_BAO_UFField',
333 'name' => 'is_required',
334 'type' => CRM_Utils_Type
::T_BOOLEAN
,
335 'title' => ts('Profile Field Is Required'),
336 'description' => ts('Is this field required when included in a user or registration form?'),
338 'where' => 'civicrm_uf_field.is_required',
340 'table_name' => 'civicrm_uf_field',
341 'entity' => 'UFField',
342 'bao' => 'CRM_Core_BAO_UFField',
348 'type' => CRM_Utils_Type
::T_INT
,
349 'title' => ts('Order'),
350 'description' => ts('Controls field display order when user framework fields are displayed in registration and account editing forms.'),
352 'where' => 'civicrm_uf_field.weight',
354 'table_name' => 'civicrm_uf_field',
355 'entity' => 'UFField',
356 'bao' => 'CRM_Core_BAO_UFField',
361 'name' => 'help_post',
362 'type' => CRM_Utils_Type
::T_TEXT
,
363 'title' => ts('Profile Field Post Help'),
364 'description' => ts('Description and/or help text to display after this field.'),
365 'where' => 'civicrm_uf_field.help_post',
366 'table_name' => 'civicrm_uf_field',
367 'entity' => 'UFField',
368 'bao' => 'CRM_Core_BAO_UFField',
373 'name' => 'help_pre',
374 'type' => CRM_Utils_Type
::T_TEXT
,
375 'title' => ts('Profile Field Pre Help'),
376 'description' => ts('Description and/or help text to display before this field.'),
377 'where' => 'civicrm_uf_field.help_pre',
378 'table_name' => 'civicrm_uf_field',
379 'entity' => 'UFField',
380 'bao' => 'CRM_Core_BAO_UFField',
385 'name' => 'visibility',
386 'type' => CRM_Utils_Type
::T_STRING
,
387 'title' => ts('Profile Field Visibility'),
388 'description' => ts('In what context(s) is this field visible.'),
390 'size' => CRM_Utils_Type
::MEDIUM
,
391 'where' => 'civicrm_uf_field.visibility',
392 'default' => 'User and User Admin Only',
393 'table_name' => 'civicrm_uf_field',
394 'entity' => 'UFField',
395 'bao' => 'CRM_Core_BAO_UFField',
400 'pseudoconstant' => [
401 'callback' => 'CRM_Core_SelectValues::ufVisibility',
406 'name' => 'in_selector',
407 'type' => CRM_Utils_Type
::T_BOOLEAN
,
408 'title' => ts('Profile Field Is a Filter'),
409 'description' => ts('Is this field included as a column in the selector table?'),
411 'where' => 'civicrm_uf_field.in_selector',
413 'table_name' => 'civicrm_uf_field',
414 'entity' => 'UFField',
415 'bao' => 'CRM_Core_BAO_UFField',
420 'name' => 'is_searchable',
421 'type' => CRM_Utils_Type
::T_BOOLEAN
,
422 'title' => ts('Profile Field Is Searchable'),
423 'description' => ts('Is this field included search form of profile?'),
425 'where' => 'civicrm_uf_field.is_searchable',
427 'table_name' => 'civicrm_uf_field',
428 'entity' => 'UFField',
429 'bao' => 'CRM_Core_BAO_UFField',
433 'location_type_id' => [
434 'name' => 'location_type_id',
435 'type' => CRM_Utils_Type
::T_INT
,
436 'title' => ts('Location Type ID'),
437 'description' => ts('Location type of this mapping, if required'),
438 'where' => 'civicrm_uf_field.location_type_id',
439 'table_name' => 'civicrm_uf_field',
440 'entity' => 'UFField',
441 'bao' => 'CRM_Core_BAO_UFField',
443 'FKClassName' => 'CRM_Core_DAO_LocationType',
445 'label' => ts("Location Type"),
450 'name' => 'phone_type_id',
451 'type' => CRM_Utils_Type
::T_INT
,
452 'title' => ts('Profile Field Phone Type'),
453 'description' => ts('Phone Type ID, if required'),
454 'where' => 'civicrm_uf_field.phone_type_id',
455 'table_name' => 'civicrm_uf_field',
456 'entity' => 'UFField',
457 'bao' => 'CRM_Core_BAO_UFField',
459 'pseudoconstant' => [
460 'optionGroupName' => 'phone_type',
461 'optionEditPath' => 'civicrm/admin/options/phone_type',
465 'website_type_id' => [
466 'name' => 'website_type_id',
467 'type' => CRM_Utils_Type
::T_INT
,
468 'title' => ts('Profile Field Website Type'),
469 'description' => ts('Website Type ID, if required'),
470 'where' => 'civicrm_uf_field.website_type_id',
471 'table_name' => 'civicrm_uf_field',
472 'entity' => 'UFField',
473 'bao' => 'CRM_Core_BAO_UFField',
475 'pseudoconstant' => [
476 'optionGroupName' => 'website_type',
477 'optionEditPath' => 'civicrm/admin/options/website_type',
483 'type' => CRM_Utils_Type
::T_STRING
,
484 'title' => ts('Profile Field Label'),
485 'description' => ts('To save label for fields.'),
488 'size' => CRM_Utils_Type
::HUGE
,
489 'where' => 'civicrm_uf_field.label',
490 'table_name' => 'civicrm_uf_field',
491 'entity' => 'UFField',
492 'bao' => 'CRM_Core_BAO_UFField',
497 'name' => 'field_type',
498 'type' => CRM_Utils_Type
::T_STRING
,
499 'title' => ts('Profile Field Type'),
500 'description' => ts('This field saves field type (ie individual,household.. field etc).'),
502 'size' => CRM_Utils_Type
::HUGE
,
503 'where' => 'civicrm_uf_field.field_type',
504 'table_name' => 'civicrm_uf_field',
505 'entity' => 'UFField',
506 'bao' => 'CRM_Core_BAO_UFField',
511 'name' => 'is_reserved',
512 'type' => CRM_Utils_Type
::T_BOOLEAN
,
513 'title' => ts('Profile Field Is Reserved'),
514 'description' => ts('Is this field reserved for use by some other CiviCRM functionality?'),
516 'where' => 'civicrm_uf_field.is_reserved',
518 'table_name' => 'civicrm_uf_field',
519 'entity' => 'UFField',
520 'bao' => 'CRM_Core_BAO_UFField',
524 'is_multi_summary' => [
525 'name' => 'is_multi_summary',
526 'type' => CRM_Utils_Type
::T_BOOLEAN
,
527 'title' => ts('Profile Field Supports Multiple'),
528 'description' => ts('Include in multi-record listing?'),
530 'where' => 'civicrm_uf_field.is_multi_summary',
532 'table_name' => 'civicrm_uf_field',
533 'entity' => 'UFField',
534 'bao' => 'CRM_Core_BAO_UFField',
539 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
541 return Civi
::$statics[__CLASS__
]['fields'];
545 * Return a mapping from field-name to the corresponding key (as used in fields()).
548 * Array(string $name => string $uniqueName).
550 public static function &fieldKeys() {
551 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
552 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
554 return Civi
::$statics[__CLASS__
]['fieldKeys'];
558 * Returns the names of this table
562 public static function getTableName() {
563 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
567 * Returns if this table needs to be logged
571 public function getLog() {
576 * Returns the list of fields that can be imported
578 * @param bool $prefix
582 public static function &import($prefix = FALSE) {
583 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'uf_field', $prefix, []);
588 * Returns the list of fields that can be exported
590 * @param bool $prefix
594 public static function &export($prefix = FALSE) {
595 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'uf_field', $prefix, []);
600 * Returns the list of indices
602 * @param bool $localize
606 public static function indices($localize = TRUE) {
608 'IX_website_type_id' => [
609 'name' => 'IX_website_type_id',
611 0 => 'website_type_id',
613 'localizable' => FALSE,
614 'sig' => 'civicrm_uf_field::0::website_type_id',
617 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;