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:dbab868218968878ca554480f974c2b4)
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.
63 * @var bool|string|null
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.
72 * @var bool|string|null
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?
81 * @var bool|string|null
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?
126 * @var bool|string|null
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?
135 * @var bool|string|null
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?
189 * @var bool|string|null
190 * (SQL type: tinyint)
191 * Note that values will be retrieved from the database as a string.
196 * Include in multi-record listing?
198 * @var bool|string|null
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.'),
309 'where' => 'civicrm_uf_field.is_active',
311 'table_name' => 'civicrm_uf_field',
312 'entity' => 'UFField',
313 'bao' => 'CRM_Core_BAO_UFField',
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',
324 'table_name' => 'civicrm_uf_field',
325 'entity' => 'UFField',
326 'bao' => 'CRM_Core_BAO_UFField',
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',
337 'table_name' => 'civicrm_uf_field',
338 'entity' => 'UFField',
339 'bao' => 'CRM_Core_BAO_UFField',
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.'),
349 'where' => 'civicrm_uf_field.weight',
351 'table_name' => 'civicrm_uf_field',
352 'entity' => 'UFField',
353 'bao' => 'CRM_Core_BAO_UFField',
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',
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',
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.'),
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',
397 'pseudoconstant' => [
398 'callback' => 'CRM_Core_SelectValues::ufVisibility',
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',
409 'table_name' => 'civicrm_uf_field',
410 'entity' => 'UFField',
411 'bao' => 'CRM_Core_BAO_UFField',
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',
422 'table_name' => 'civicrm_uf_field',
423 'entity' => 'UFField',
424 'bao' => 'CRM_Core_BAO_UFField',
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',
438 'FKClassName' => 'CRM_Core_DAO_LocationType',
440 'label' => ts("Location Type"),
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',
454 'pseudoconstant' => [
455 'optionGroupName' => 'phone_type',
456 'optionEditPath' => 'civicrm/admin/options/phone_type',
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',
470 'pseudoconstant' => [
471 'optionGroupName' => 'website_type',
472 'optionEditPath' => 'civicrm/admin/options/website_type',
478 'type' => CRM_Utils_Type
::T_STRING
,
479 'title' => ts('Profile Field Label'),
480 'description' => ts('To save label for fields.'),
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',
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).'),
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',
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',
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',
524 'table_name' => 'civicrm_uf_field',
525 'entity' => 'UFField',
526 'bao' => 'CRM_Core_BAO_UFField',
531 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
533 return Civi
::$statics[__CLASS__
]['fields'];
537 * Return a mapping from field-name to the corresponding key (as used in fields()).
540 * Array(string $name => string $uniqueName).
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()));
546 return Civi
::$statics[__CLASS__
]['fieldKeys'];
550 * Returns the names of this table
554 public static function getTableName() {
555 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
559 * Returns if this table needs to be logged
563 public function getLog() {
568 * Returns the list of fields that can be imported
570 * @param bool $prefix
574 public static function &import($prefix = FALSE) {
575 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'uf_field', $prefix, []);
580 * Returns the list of fields that can be exported
582 * @param bool $prefix
586 public static function &export($prefix = FALSE) {
587 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'uf_field', $prefix, []);
592 * Returns the list of indices
594 * @param bool $localize
598 public static function indices($localize = TRUE) {
600 'IX_website_type_id' => [
601 'name' => 'IX_website_type_id',
603 0 => 'website_type_id',
605 'localizable' => FALSE,
606 'sig' => 'civicrm_uf_field::0::website_type_id',
609 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;