5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/CustomGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0c41f19103b41d2f82bcd3b60aaf2165)
13 * Database access object for the CustomGroup entity.
15 class CRM_Core_DAO_CustomGroup
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_custom_group';
27 * Field to show when displaying a record.
31 public static $_labelField = 'title';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = TRUE;
41 * Paths for accessing this entity in the UI.
45 protected static $_paths = [
46 'add' => 'civicrm/admin/custom/group/edit?action=add&reset=1',
47 'update' => 'civicrm/admin/custom/group/edit?action=update&reset=1&id=[id]',
48 'preview' => 'civicrm/admin/custom/group/preview?reset=1&gid=[id]',
49 'delete' => 'civicrm/admin/custom/group/delete?reset=1&id=[id]',
53 * Unique Custom Group ID
55 * @var int|string|null
56 * (SQL type: int unsigned)
57 * Note that values will be retrieved from the database as a string.
62 * Variable name/programmatic handle for this group.
65 * (SQL type: varchar(64))
66 * Note that values will be retrieved from the database as a string.
74 * (SQL type: varchar(64))
75 * Note that values will be retrieved from the database as a string.
80 * Type of object this group extends (can add other options later e.g. contact_address, etc.).
83 * (SQL type: varchar(255))
84 * Note that values will be retrieved from the database as a string.
89 * FK to civicrm_option_value.id (for option group custom_data_type.)
91 * @var int|string|null
92 * (SQL type: int unsigned)
93 * Note that values will be retrieved from the database as a string.
95 public $extends_entity_column_id;
98 * linking custom group for dynamic object
101 * (SQL type: varchar(255))
102 * Note that values will be retrieved from the database as a string.
104 public $extends_entity_column_value;
107 * Visual relationship between this form and its parent.
110 * (SQL type: varchar(15))
111 * Note that values will be retrieved from the database as a string.
116 * Will this group be in collapsed or expanded mode on initial display ?
118 * @var bool|string|null
119 * (SQL type: tinyint)
120 * Note that values will be retrieved from the database as a string.
122 public $collapse_display;
125 * Description and/or help text to display before fields in form.
129 * Note that values will be retrieved from the database as a string.
134 * Description and/or help text to display after fields in form.
138 * Note that values will be retrieved from the database as a string.
143 * Controls display order when multiple extended property groups are setup for the same class.
147 * Note that values will be retrieved from the database as a string.
152 * Is this property active?
154 * @var bool|string|null
155 * (SQL type: tinyint)
156 * Note that values will be retrieved from the database as a string.
161 * Name of the table that holds the values for this group.
164 * (SQL type: varchar(255))
165 * Note that values will be retrieved from the database as a string.
170 * Does this group hold multiple values?
172 * @var bool|string|null
173 * (SQL type: tinyint)
174 * Note that values will be retrieved from the database as a string.
179 * minimum number of multiple records (typically 0?)
181 * @var int|string|null
182 * (SQL type: int unsigned)
183 * Note that values will be retrieved from the database as a string.
185 public $min_multiple;
188 * maximum number of multiple records, if 0 - no max
190 * @var int|string|null
191 * (SQL type: int unsigned)
192 * Note that values will be retrieved from the database as a string.
194 public $max_multiple;
197 * Will this group be in collapsed or expanded mode on advanced search display ?
199 * @var bool|string|null
200 * (SQL type: tinyint)
201 * Note that values will be retrieved from the database as a string.
203 public $collapse_adv_display;
206 * FK to civicrm_contact, who created this custom group
208 * @var int|string|null
209 * (SQL type: int unsigned)
210 * Note that values will be retrieved from the database as a string.
215 * Date and time this custom group was created.
218 * (SQL type: datetime)
219 * Note that values will be retrieved from the database as a string.
221 public $created_date;
224 * Is this a reserved Custom Group?
226 * @var bool|string|null
227 * (SQL type: tinyint)
228 * Note that values will be retrieved from the database as a string.
233 * Is this property public?
235 * @var bool|string|null
236 * (SQL type: tinyint)
237 * Note that values will be retrieved from the database as a string.
245 * (SQL type: varchar(255))
246 * Note that values will be retrieved from the database as a string.
253 public function __construct() {
254 $this->__table
= 'civicrm_custom_group';
255 parent
::__construct();
259 * Returns localized title of this entity.
261 * @param bool $plural
262 * Whether to return the plural version of the title.
264 public static function getEntityTitle($plural = FALSE) {
265 return $plural ?
ts('Custom Field Groups') : ts('Custom Field Group');
269 * Returns foreign keys and entity references.
272 * [CRM_Core_Reference_Interface]
274 public static function getReferenceColumns() {
275 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
276 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
277 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
278 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
280 return Civi
::$statics[__CLASS__
]['links'];
284 * Returns all the column names of this table
288 public static function &fields() {
289 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
290 Civi
::$statics[__CLASS__
]['fields'] = [
293 'type' => CRM_Utils_Type
::T_INT
,
294 'title' => ts('Custom Group ID'),
295 'description' => ts('Unique Custom Group ID'),
297 'where' => 'civicrm_custom_group.id',
298 'table_name' => 'civicrm_custom_group',
299 'entity' => 'CustomGroup',
300 'bao' => 'CRM_Core_BAO_CustomGroup',
310 'type' => CRM_Utils_Type
::T_STRING
,
311 'title' => ts('Custom Group Name'),
312 'description' => ts('Variable name/programmatic handle for this group.'),
314 'size' => CRM_Utils_Type
::BIG
,
315 'where' => 'civicrm_custom_group.name',
316 'table_name' => 'civicrm_custom_group',
317 'entity' => 'CustomGroup',
318 'bao' => 'CRM_Core_BAO_CustomGroup',
324 'type' => CRM_Utils_Type
::T_STRING
,
325 'title' => ts('Custom Group Title'),
326 'description' => ts('Friendly Name.'),
329 'size' => CRM_Utils_Type
::BIG
,
330 'where' => 'civicrm_custom_group.title',
331 'table_name' => 'civicrm_custom_group',
332 'entity' => 'CustomGroup',
333 'bao' => 'CRM_Core_BAO_CustomGroup',
339 'type' => CRM_Utils_Type
::T_STRING
,
340 'title' => ts('Custom Group Extends'),
341 'description' => ts('Type of object this group extends (can add other options later e.g. contact_address, etc.).'),
343 'size' => CRM_Utils_Type
::HUGE
,
344 'where' => 'civicrm_custom_group.extends',
345 'default' => 'Contact',
346 'table_name' => 'civicrm_custom_group',
347 'entity' => 'CustomGroup',
348 'bao' => 'CRM_Core_BAO_CustomGroup',
350 'pseudoconstant' => [
351 'callback' => 'CRM_Core_SelectValues::customGroupExtends',
355 'extends_entity_column_id' => [
356 'name' => 'extends_entity_column_id',
357 'type' => CRM_Utils_Type
::T_INT
,
358 'title' => ts('Custom Group Subtype List'),
359 'description' => ts('FK to civicrm_option_value.id (for option group custom_data_type.)'),
360 'where' => 'civicrm_custom_group.extends_entity_column_id',
362 'table_name' => 'civicrm_custom_group',
363 'entity' => 'CustomGroup',
364 'bao' => 'CRM_Core_BAO_CustomGroup',
369 'pseudoconstant' => [
370 'optionGroupName' => 'custom_data_type',
371 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
375 'extends_entity_column_value' => [
376 'name' => 'extends_entity_column_value',
377 'type' => CRM_Utils_Type
::T_STRING
,
378 'title' => ts('Custom Group Subtype'),
379 'description' => ts('linking custom group for dynamic object'),
381 'size' => CRM_Utils_Type
::HUGE
,
382 'where' => 'civicrm_custom_group.extends_entity_column_value',
383 'table_name' => 'civicrm_custom_group',
384 'entity' => 'CustomGroup',
385 'bao' => 'CRM_Core_BAO_CustomGroup',
387 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
392 'type' => CRM_Utils_Type
::T_STRING
,
393 'title' => ts('Custom Group Style'),
394 'description' => ts('Visual relationship between this form and its parent.'),
396 'size' => CRM_Utils_Type
::TWELVE
,
397 'where' => 'civicrm_custom_group.style',
398 'table_name' => 'civicrm_custom_group',
399 'entity' => 'CustomGroup',
400 'bao' => 'CRM_Core_BAO_CustomGroup',
405 'pseudoconstant' => [
406 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
410 'collapse_display' => [
411 'name' => 'collapse_display',
412 'type' => CRM_Utils_Type
::T_BOOLEAN
,
413 'title' => ts('Collapse Custom Group?'),
414 'description' => ts('Will this group be in collapsed or expanded mode on initial display ?'),
415 'where' => 'civicrm_custom_group.collapse_display',
417 'table_name' => 'civicrm_custom_group',
418 'entity' => 'CustomGroup',
419 'bao' => 'CRM_Core_BAO_CustomGroup',
424 'name' => 'help_pre',
425 'type' => CRM_Utils_Type
::T_TEXT
,
426 'title' => ts('Custom Group Pre Text'),
427 'description' => ts('Description and/or help text to display before fields in form.'),
430 'where' => 'civicrm_custom_group.help_pre',
431 'table_name' => 'civicrm_custom_group',
432 'entity' => 'CustomGroup',
433 'bao' => 'CRM_Core_BAO_CustomGroup',
436 'type' => 'TextArea',
441 'name' => 'help_post',
442 'type' => CRM_Utils_Type
::T_TEXT
,
443 'title' => ts('Custom Group Post Text'),
444 'description' => ts('Description and/or help text to display after fields in form.'),
447 'where' => 'civicrm_custom_group.help_post',
448 'table_name' => 'civicrm_custom_group',
449 'entity' => 'CustomGroup',
450 'bao' => 'CRM_Core_BAO_CustomGroup',
453 'type' => 'TextArea',
459 'type' => CRM_Utils_Type
::T_INT
,
460 'title' => ts('Order'),
461 'description' => ts('Controls display order when multiple extended property groups are setup for the same class.'),
463 'where' => 'civicrm_custom_group.weight',
465 'table_name' => 'civicrm_custom_group',
466 'entity' => 'CustomGroup',
467 'bao' => 'CRM_Core_BAO_CustomGroup',
472 'name' => 'is_active',
473 'type' => CRM_Utils_Type
::T_BOOLEAN
,
474 'title' => ts('Custom Group Is Active?'),
475 'description' => ts('Is this property active?'),
476 'where' => 'civicrm_custom_group.is_active',
478 'table_name' => 'civicrm_custom_group',
479 'entity' => 'CustomGroup',
480 'bao' => 'CRM_Core_BAO_CustomGroup',
485 'name' => 'table_name',
486 'type' => CRM_Utils_Type
::T_STRING
,
487 'title' => ts('Table Name'),
488 'description' => ts('Name of the table that holds the values for this group.'),
490 'size' => CRM_Utils_Type
::HUGE
,
491 'where' => 'civicrm_custom_group.table_name',
492 'table_name' => 'civicrm_custom_group',
493 'entity' => 'CustomGroup',
494 'bao' => 'CRM_Core_BAO_CustomGroup',
497 'label' => ts("Table Name"),
503 'name' => 'is_multiple',
504 'type' => CRM_Utils_Type
::T_BOOLEAN
,
505 'title' => ts('Supports Multiple Records'),
506 'description' => ts('Does this group hold multiple values?'),
507 'where' => 'civicrm_custom_group.is_multiple',
509 'table_name' => 'civicrm_custom_group',
510 'entity' => 'CustomGroup',
511 'bao' => 'CRM_Core_BAO_CustomGroup',
516 'name' => 'min_multiple',
517 'type' => CRM_Utils_Type
::T_INT
,
518 'title' => ts('Minimum Multiple Records'),
519 'description' => ts('minimum number of multiple records (typically 0?)'),
520 'where' => 'civicrm_custom_group.min_multiple',
521 'table_name' => 'civicrm_custom_group',
522 'entity' => 'CustomGroup',
523 'bao' => 'CRM_Core_BAO_CustomGroup',
528 'name' => 'max_multiple',
529 'type' => CRM_Utils_Type
::T_INT
,
530 'title' => ts('Maximum Multiple Records'),
531 'description' => ts('maximum number of multiple records, if 0 - no max'),
532 'where' => 'civicrm_custom_group.max_multiple',
533 'table_name' => 'civicrm_custom_group',
534 'entity' => 'CustomGroup',
535 'bao' => 'CRM_Core_BAO_CustomGroup',
539 'collapse_adv_display' => [
540 'name' => 'collapse_adv_display',
541 'type' => CRM_Utils_Type
::T_BOOLEAN
,
542 'title' => ts('Collapse Group Display'),
543 'description' => ts('Will this group be in collapsed or expanded mode on advanced search display ?'),
544 'where' => 'civicrm_custom_group.collapse_adv_display',
546 'table_name' => 'civicrm_custom_group',
547 'entity' => 'CustomGroup',
548 'bao' => 'CRM_Core_BAO_CustomGroup',
553 'name' => 'created_id',
554 'type' => CRM_Utils_Type
::T_INT
,
555 'title' => ts('Created By Contact ID'),
556 'description' => ts('FK to civicrm_contact, who created this custom group'),
557 'where' => 'civicrm_custom_group.created_id',
558 'table_name' => 'civicrm_custom_group',
559 'entity' => 'CustomGroup',
560 'bao' => 'CRM_Core_BAO_CustomGroup',
562 'FKClassName' => 'CRM_Contact_DAO_Contact',
564 'label' => ts("Created By"),
569 'name' => 'created_date',
570 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
571 'title' => ts('Custom Group Created Date'),
572 'description' => ts('Date and time this custom group was created.'),
573 'where' => 'civicrm_custom_group.created_date',
574 'table_name' => 'civicrm_custom_group',
575 'entity' => 'CustomGroup',
576 'bao' => 'CRM_Core_BAO_CustomGroup',
581 'name' => 'is_reserved',
582 'type' => CRM_Utils_Type
::T_BOOLEAN
,
583 'title' => ts('Reserved Group?'),
584 'description' => ts('Is this a reserved Custom Group?'),
585 'where' => 'civicrm_custom_group.is_reserved',
587 'table_name' => 'civicrm_custom_group',
588 'entity' => 'CustomGroup',
589 'bao' => 'CRM_Core_BAO_CustomGroup',
594 'name' => 'is_public',
595 'type' => CRM_Utils_Type
::T_BOOLEAN
,
596 'title' => ts('Custom Group Is Public?'),
597 'description' => ts('Is this property public?'),
598 'where' => 'civicrm_custom_group.is_public',
600 'table_name' => 'civicrm_custom_group',
601 'entity' => 'CustomGroup',
602 'bao' => 'CRM_Core_BAO_CustomGroup',
608 'type' => CRM_Utils_Type
::T_STRING
,
609 'title' => ts('Icon'),
610 'description' => ts('crm-i icon class'),
612 'size' => CRM_Utils_Type
::HUGE
,
613 'where' => 'civicrm_custom_group.icon',
615 'table_name' => 'civicrm_custom_group',
616 'entity' => 'CustomGroup',
617 'bao' => 'CRM_Core_BAO_CustomGroup',
622 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
624 return Civi
::$statics[__CLASS__
]['fields'];
628 * Return a mapping from field-name to the corresponding key (as used in fields()).
631 * Array(string $name => string $uniqueName).
633 public static function &fieldKeys() {
634 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
635 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
637 return Civi
::$statics[__CLASS__
]['fieldKeys'];
641 * Returns the names of this table
645 public static function getTableName() {
646 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
650 * Returns if this table needs to be logged
654 public function getLog() {
659 * Returns the list of fields that can be imported
661 * @param bool $prefix
665 public static function &import($prefix = FALSE) {
666 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'custom_group', $prefix, []);
671 * Returns the list of fields that can be exported
673 * @param bool $prefix
677 public static function &export($prefix = FALSE) {
678 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'custom_group', $prefix, []);
683 * Returns the list of indices
685 * @param bool $localize
689 public static function indices($localize = TRUE) {
691 'UI_title_extends' => [
692 'name' => 'UI_title_extends',
697 'localizable' => TRUE,
699 'sig' => 'civicrm_custom_group::1::title::extends',
701 'UI_name_extends' => [
702 'name' => 'UI_name_extends',
707 'localizable' => FALSE,
709 'sig' => 'civicrm_custom_group::1::name::extends',
712 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;