Merge pull request #23488 from colemanw/afformGetHook
[civicrm-core.git] / CRM / Core / DAO / CustomGroup.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/CustomGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:22712766c53c71ece90631f131f338a4)
10 */
11
12 /**
13 * Database access object for the CustomGroup entity.
14 */
15 class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_custom_group';
25
26 /**
27 * Field to show when displaying a record.
28 *
29 * @var string
30 */
31 public static $_labelField = 'title';
32
33 /**
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
35 *
36 * @var bool
37 */
38 public static $_log = TRUE;
39
40 /**
41 * Paths for accessing this entity in the UI.
42 *
43 * @var string[]
44 */
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]',
50 ];
51
52 /**
53 * Unique Custom Group ID
54 *
55 * @var int|string|null
56 * (SQL type: int unsigned)
57 * Note that values will be retrieved from the database as a string.
58 */
59 public $id;
60
61 /**
62 * Variable name/programmatic handle for this group.
63 *
64 * @var string|null
65 * (SQL type: varchar(64))
66 * Note that values will be retrieved from the database as a string.
67 */
68 public $name;
69
70 /**
71 * Friendly Name.
72 *
73 * @var string
74 * (SQL type: varchar(64))
75 * Note that values will be retrieved from the database as a string.
76 */
77 public $title;
78
79 /**
80 * Type of object this group extends (can add other options later e.g. contact_address, etc.).
81 *
82 * @var string|null
83 * (SQL type: varchar(255))
84 * Note that values will be retrieved from the database as a string.
85 */
86 public $extends;
87
88 /**
89 * FK to civicrm_option_value.id (for option group custom_data_type.)
90 *
91 * @var int|string|null
92 * (SQL type: int unsigned)
93 * Note that values will be retrieved from the database as a string.
94 */
95 public $extends_entity_column_id;
96
97 /**
98 * linking custom group for dynamic object
99 *
100 * @var string|null
101 * (SQL type: varchar(255))
102 * Note that values will be retrieved from the database as a string.
103 */
104 public $extends_entity_column_value;
105
106 /**
107 * Visual relationship between this form and its parent.
108 *
109 * @var string|null
110 * (SQL type: varchar(15))
111 * Note that values will be retrieved from the database as a string.
112 */
113 public $style;
114
115 /**
116 * Will this group be in collapsed or expanded mode on initial display ?
117 *
118 * @var bool|string
119 * (SQL type: tinyint)
120 * Note that values will be retrieved from the database as a string.
121 */
122 public $collapse_display;
123
124 /**
125 * Description and/or help text to display before fields in form.
126 *
127 * @var string|null
128 * (SQL type: text)
129 * Note that values will be retrieved from the database as a string.
130 */
131 public $help_pre;
132
133 /**
134 * Description and/or help text to display after fields in form.
135 *
136 * @var string|null
137 * (SQL type: text)
138 * Note that values will be retrieved from the database as a string.
139 */
140 public $help_post;
141
142 /**
143 * Controls display order when multiple extended property groups are setup for the same class.
144 *
145 * @var int|string
146 * (SQL type: int)
147 * Note that values will be retrieved from the database as a string.
148 */
149 public $weight;
150
151 /**
152 * Is this property active?
153 *
154 * @var bool|string
155 * (SQL type: tinyint)
156 * Note that values will be retrieved from the database as a string.
157 */
158 public $is_active;
159
160 /**
161 * Name of the table that holds the values for this group.
162 *
163 * @var string|null
164 * (SQL type: varchar(255))
165 * Note that values will be retrieved from the database as a string.
166 */
167 public $table_name;
168
169 /**
170 * Does this group hold multiple values?
171 *
172 * @var bool|string
173 * (SQL type: tinyint)
174 * Note that values will be retrieved from the database as a string.
175 */
176 public $is_multiple;
177
178 /**
179 * minimum number of multiple records (typically 0?)
180 *
181 * @var int|string|null
182 * (SQL type: int unsigned)
183 * Note that values will be retrieved from the database as a string.
184 */
185 public $min_multiple;
186
187 /**
188 * maximum number of multiple records, if 0 - no max
189 *
190 * @var int|string|null
191 * (SQL type: int unsigned)
192 * Note that values will be retrieved from the database as a string.
193 */
194 public $max_multiple;
195
196 /**
197 * Will this group be in collapsed or expanded mode on advanced search display ?
198 *
199 * @var bool|string
200 * (SQL type: tinyint)
201 * Note that values will be retrieved from the database as a string.
202 */
203 public $collapse_adv_display;
204
205 /**
206 * FK to civicrm_contact, who created this custom group
207 *
208 * @var int|string|null
209 * (SQL type: int unsigned)
210 * Note that values will be retrieved from the database as a string.
211 */
212 public $created_id;
213
214 /**
215 * Date and time this custom group was created.
216 *
217 * @var string|null
218 * (SQL type: datetime)
219 * Note that values will be retrieved from the database as a string.
220 */
221 public $created_date;
222
223 /**
224 * Is this a reserved Custom Group?
225 *
226 * @var bool|string
227 * (SQL type: tinyint)
228 * Note that values will be retrieved from the database as a string.
229 */
230 public $is_reserved;
231
232 /**
233 * Is this property public?
234 *
235 * @var bool|string
236 * (SQL type: tinyint)
237 * Note that values will be retrieved from the database as a string.
238 */
239 public $is_public;
240
241 /**
242 * crm-i icon class
243 *
244 * @var string|null
245 * (SQL type: varchar(255))
246 * Note that values will be retrieved from the database as a string.
247 */
248 public $icon;
249
250 /**
251 * Class constructor.
252 */
253 public function __construct() {
254 $this->__table = 'civicrm_custom_group';
255 parent::__construct();
256 }
257
258 /**
259 * Returns localized title of this entity.
260 *
261 * @param bool $plural
262 * Whether to return the plural version of the title.
263 */
264 public static function getEntityTitle($plural = FALSE) {
265 return $plural ? ts('Custom Field Groups') : ts('Custom Field Group');
266 }
267
268 /**
269 * Returns foreign keys and entity references.
270 *
271 * @return array
272 * [CRM_Core_Reference_Interface]
273 */
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']);
279 }
280 return Civi::$statics[__CLASS__]['links'];
281 }
282
283 /**
284 * Returns all the column names of this table
285 *
286 * @return array
287 */
288 public static function &fields() {
289 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
290 Civi::$statics[__CLASS__]['fields'] = [
291 'id' => [
292 'name' => 'id',
293 'type' => CRM_Utils_Type::T_INT,
294 'title' => ts('Custom Group ID'),
295 'description' => ts('Unique Custom Group ID'),
296 'required' => TRUE,
297 'where' => 'civicrm_custom_group.id',
298 'table_name' => 'civicrm_custom_group',
299 'entity' => 'CustomGroup',
300 'bao' => 'CRM_Core_BAO_CustomGroup',
301 'localizable' => 0,
302 'html' => [
303 'type' => 'Number',
304 ],
305 'readonly' => TRUE,
306 'add' => '1.1',
307 ],
308 'name' => [
309 'name' => 'name',
310 'type' => CRM_Utils_Type::T_STRING,
311 'title' => ts('Custom Group Name'),
312 'description' => ts('Variable name/programmatic handle for this group.'),
313 'maxlength' => 64,
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',
319 'localizable' => 0,
320 'add' => '1.1',
321 ],
322 'title' => [
323 'name' => 'title',
324 'type' => CRM_Utils_Type::T_STRING,
325 'title' => ts('Custom Group Title'),
326 'description' => ts('Friendly Name.'),
327 'required' => TRUE,
328 'maxlength' => 64,
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',
334 'localizable' => 1,
335 'add' => '1.1',
336 ],
337 'extends' => [
338 'name' => 'extends',
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.).'),
342 'maxlength' => 255,
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',
349 'localizable' => 0,
350 'pseudoconstant' => [
351 'callback' => 'CRM_Core_BAO_CustomGroup::getCustomGroupExtendsOptions',
352 ],
353 'add' => '1.1',
354 ],
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',
361 'default' => NULL,
362 'table_name' => 'civicrm_custom_group',
363 'entity' => 'CustomGroup',
364 'bao' => 'CRM_Core_BAO_CustomGroup',
365 'localizable' => 0,
366 'html' => [
367 'type' => 'ChainSelect',
368 'controlField' => 'extends',
369 ],
370 'pseudoconstant' => [
371 'optionGroupName' => 'custom_data_type',
372 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
373 ],
374 'add' => '2.2',
375 ],
376 'extends_entity_column_value' => [
377 'name' => 'extends_entity_column_value',
378 'type' => CRM_Utils_Type::T_STRING,
379 'title' => ts('Custom Group Subtype'),
380 'description' => ts('linking custom group for dynamic object'),
381 'maxlength' => 255,
382 'size' => CRM_Utils_Type::HUGE,
383 'where' => 'civicrm_custom_group.extends_entity_column_value',
384 'table_name' => 'civicrm_custom_group',
385 'entity' => 'CustomGroup',
386 'bao' => 'CRM_Core_BAO_CustomGroup',
387 'localizable' => 0,
388 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
389 'html' => [
390 'type' => 'ChainSelect',
391 'controlField' => 'extends_entity_column_id',
392 ],
393 'pseudoconstant' => [
394 'callback' => 'CRM_Core_BAO_CustomGroup::getExtendsEntityColumnValueOptions',
395 ],
396 'add' => '1.6',
397 ],
398 'style' => [
399 'name' => 'style',
400 'type' => CRM_Utils_Type::T_STRING,
401 'title' => ts('Custom Group Style'),
402 'description' => ts('Visual relationship between this form and its parent.'),
403 'maxlength' => 15,
404 'size' => CRM_Utils_Type::TWELVE,
405 'where' => 'civicrm_custom_group.style',
406 'table_name' => 'civicrm_custom_group',
407 'entity' => 'CustomGroup',
408 'bao' => 'CRM_Core_BAO_CustomGroup',
409 'localizable' => 0,
410 'html' => [
411 'type' => 'Select',
412 ],
413 'pseudoconstant' => [
414 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
415 ],
416 'add' => '1.1',
417 ],
418 'collapse_display' => [
419 'name' => 'collapse_display',
420 'type' => CRM_Utils_Type::T_BOOLEAN,
421 'title' => ts('Collapse Custom Group?'),
422 'description' => ts('Will this group be in collapsed or expanded mode on initial display ?'),
423 'required' => TRUE,
424 'where' => 'civicrm_custom_group.collapse_display',
425 'default' => '0',
426 'table_name' => 'civicrm_custom_group',
427 'entity' => 'CustomGroup',
428 'bao' => 'CRM_Core_BAO_CustomGroup',
429 'localizable' => 0,
430 'add' => '1.1',
431 ],
432 'help_pre' => [
433 'name' => 'help_pre',
434 'type' => CRM_Utils_Type::T_TEXT,
435 'title' => ts('Custom Group Pre Text'),
436 'description' => ts('Description and/or help text to display before fields in form.'),
437 'rows' => 4,
438 'cols' => 80,
439 'where' => 'civicrm_custom_group.help_pre',
440 'table_name' => 'civicrm_custom_group',
441 'entity' => 'CustomGroup',
442 'bao' => 'CRM_Core_BAO_CustomGroup',
443 'localizable' => 1,
444 'html' => [
445 'type' => 'TextArea',
446 ],
447 'add' => '1.1',
448 ],
449 'help_post' => [
450 'name' => 'help_post',
451 'type' => CRM_Utils_Type::T_TEXT,
452 'title' => ts('Custom Group Post Text'),
453 'description' => ts('Description and/or help text to display after fields in form.'),
454 'rows' => 4,
455 'cols' => 80,
456 'where' => 'civicrm_custom_group.help_post',
457 'table_name' => 'civicrm_custom_group',
458 'entity' => 'CustomGroup',
459 'bao' => 'CRM_Core_BAO_CustomGroup',
460 'localizable' => 1,
461 'html' => [
462 'type' => 'TextArea',
463 ],
464 'add' => '1.1',
465 ],
466 'weight' => [
467 'name' => 'weight',
468 'type' => CRM_Utils_Type::T_INT,
469 'title' => ts('Order'),
470 'description' => ts('Controls display order when multiple extended property groups are setup for the same class.'),
471 'required' => TRUE,
472 'where' => 'civicrm_custom_group.weight',
473 'default' => '1',
474 'table_name' => 'civicrm_custom_group',
475 'entity' => 'CustomGroup',
476 'bao' => 'CRM_Core_BAO_CustomGroup',
477 'localizable' => 0,
478 'add' => '1.1',
479 ],
480 'is_active' => [
481 'name' => 'is_active',
482 'type' => CRM_Utils_Type::T_BOOLEAN,
483 'title' => ts('Custom Group Is Active?'),
484 'description' => ts('Is this property active?'),
485 'required' => TRUE,
486 'where' => 'civicrm_custom_group.is_active',
487 'default' => '1',
488 'table_name' => 'civicrm_custom_group',
489 'entity' => 'CustomGroup',
490 'bao' => 'CRM_Core_BAO_CustomGroup',
491 'localizable' => 0,
492 'add' => '1.1',
493 ],
494 'table_name' => [
495 'name' => 'table_name',
496 'type' => CRM_Utils_Type::T_STRING,
497 'title' => ts('Table Name'),
498 'description' => ts('Name of the table that holds the values for this group.'),
499 'maxlength' => 255,
500 'size' => CRM_Utils_Type::HUGE,
501 'where' => 'civicrm_custom_group.table_name',
502 'table_name' => 'civicrm_custom_group',
503 'entity' => 'CustomGroup',
504 'bao' => 'CRM_Core_BAO_CustomGroup',
505 'localizable' => 0,
506 'html' => [
507 'label' => ts("Table Name"),
508 ],
509 'readonly' => TRUE,
510 'add' => '2.0',
511 ],
512 'is_multiple' => [
513 'name' => 'is_multiple',
514 'type' => CRM_Utils_Type::T_BOOLEAN,
515 'title' => ts('Supports Multiple Records'),
516 'description' => ts('Does this group hold multiple values?'),
517 'required' => TRUE,
518 'where' => 'civicrm_custom_group.is_multiple',
519 'default' => '0',
520 'table_name' => 'civicrm_custom_group',
521 'entity' => 'CustomGroup',
522 'bao' => 'CRM_Core_BAO_CustomGroup',
523 'localizable' => 0,
524 'add' => '2.0',
525 ],
526 'min_multiple' => [
527 'name' => 'min_multiple',
528 'type' => CRM_Utils_Type::T_INT,
529 'title' => ts('Minimum Multiple Records'),
530 'description' => ts('minimum number of multiple records (typically 0?)'),
531 'where' => 'civicrm_custom_group.min_multiple',
532 'table_name' => 'civicrm_custom_group',
533 'entity' => 'CustomGroup',
534 'bao' => 'CRM_Core_BAO_CustomGroup',
535 'localizable' => 0,
536 'add' => '2.2',
537 ],
538 'max_multiple' => [
539 'name' => 'max_multiple',
540 'type' => CRM_Utils_Type::T_INT,
541 'title' => ts('Maximum Multiple Records'),
542 'description' => ts('maximum number of multiple records, if 0 - no max'),
543 'where' => 'civicrm_custom_group.max_multiple',
544 'table_name' => 'civicrm_custom_group',
545 'entity' => 'CustomGroup',
546 'bao' => 'CRM_Core_BAO_CustomGroup',
547 'localizable' => 0,
548 'add' => '2.2',
549 ],
550 'collapse_adv_display' => [
551 'name' => 'collapse_adv_display',
552 'type' => CRM_Utils_Type::T_BOOLEAN,
553 'title' => ts('Collapse Group Display'),
554 'description' => ts('Will this group be in collapsed or expanded mode on advanced search display ?'),
555 'required' => TRUE,
556 'where' => 'civicrm_custom_group.collapse_adv_display',
557 'default' => '0',
558 'table_name' => 'civicrm_custom_group',
559 'entity' => 'CustomGroup',
560 'bao' => 'CRM_Core_BAO_CustomGroup',
561 'localizable' => 0,
562 'add' => '3.0',
563 ],
564 'created_id' => [
565 'name' => 'created_id',
566 'type' => CRM_Utils_Type::T_INT,
567 'title' => ts('Created By Contact ID'),
568 'description' => ts('FK to civicrm_contact, who created this custom group'),
569 'where' => 'civicrm_custom_group.created_id',
570 'table_name' => 'civicrm_custom_group',
571 'entity' => 'CustomGroup',
572 'bao' => 'CRM_Core_BAO_CustomGroup',
573 'localizable' => 0,
574 'FKClassName' => 'CRM_Contact_DAO_Contact',
575 'html' => [
576 'label' => ts("Created By"),
577 ],
578 'add' => '3.0',
579 ],
580 'created_date' => [
581 'name' => 'created_date',
582 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
583 'title' => ts('Custom Group Created Date'),
584 'description' => ts('Date and time this custom group was created.'),
585 'where' => 'civicrm_custom_group.created_date',
586 'table_name' => 'civicrm_custom_group',
587 'entity' => 'CustomGroup',
588 'bao' => 'CRM_Core_BAO_CustomGroup',
589 'localizable' => 0,
590 'add' => '3.0',
591 ],
592 'is_reserved' => [
593 'name' => 'is_reserved',
594 'type' => CRM_Utils_Type::T_BOOLEAN,
595 'title' => ts('Reserved Group?'),
596 'description' => ts('Is this a reserved Custom Group?'),
597 'required' => TRUE,
598 'where' => 'civicrm_custom_group.is_reserved',
599 'default' => '0',
600 'table_name' => 'civicrm_custom_group',
601 'entity' => 'CustomGroup',
602 'bao' => 'CRM_Core_BAO_CustomGroup',
603 'localizable' => 0,
604 'add' => '4.4',
605 ],
606 'is_public' => [
607 'name' => 'is_public',
608 'type' => CRM_Utils_Type::T_BOOLEAN,
609 'title' => ts('Custom Group Is Public?'),
610 'description' => ts('Is this property public?'),
611 'required' => TRUE,
612 'where' => 'civicrm_custom_group.is_public',
613 'default' => '1',
614 'table_name' => 'civicrm_custom_group',
615 'entity' => 'CustomGroup',
616 'bao' => 'CRM_Core_BAO_CustomGroup',
617 'localizable' => 0,
618 'add' => '4.7',
619 ],
620 'icon' => [
621 'name' => 'icon',
622 'type' => CRM_Utils_Type::T_STRING,
623 'title' => ts('Icon'),
624 'description' => ts('crm-i icon class'),
625 'maxlength' => 255,
626 'size' => CRM_Utils_Type::HUGE,
627 'where' => 'civicrm_custom_group.icon',
628 'default' => NULL,
629 'table_name' => 'civicrm_custom_group',
630 'entity' => 'CustomGroup',
631 'bao' => 'CRM_Core_BAO_CustomGroup',
632 'localizable' => 0,
633 'add' => '5.28',
634 ],
635 ];
636 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
637 }
638 return Civi::$statics[__CLASS__]['fields'];
639 }
640
641 /**
642 * Return a mapping from field-name to the corresponding key (as used in fields()).
643 *
644 * @return array
645 * Array(string $name => string $uniqueName).
646 */
647 public static function &fieldKeys() {
648 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
649 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
650 }
651 return Civi::$statics[__CLASS__]['fieldKeys'];
652 }
653
654 /**
655 * Returns the names of this table
656 *
657 * @return string
658 */
659 public static function getTableName() {
660 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
661 }
662
663 /**
664 * Returns if this table needs to be logged
665 *
666 * @return bool
667 */
668 public function getLog() {
669 return self::$_log;
670 }
671
672 /**
673 * Returns the list of fields that can be imported
674 *
675 * @param bool $prefix
676 *
677 * @return array
678 */
679 public static function &import($prefix = FALSE) {
680 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []);
681 return $r;
682 }
683
684 /**
685 * Returns the list of fields that can be exported
686 *
687 * @param bool $prefix
688 *
689 * @return array
690 */
691 public static function &export($prefix = FALSE) {
692 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []);
693 return $r;
694 }
695
696 /**
697 * Returns the list of indices
698 *
699 * @param bool $localize
700 *
701 * @return array
702 */
703 public static function indices($localize = TRUE) {
704 $indices = [
705 'UI_title_extends' => [
706 'name' => 'UI_title_extends',
707 'field' => [
708 0 => 'title',
709 1 => 'extends',
710 ],
711 'localizable' => TRUE,
712 'unique' => TRUE,
713 'sig' => 'civicrm_custom_group::1::title::extends',
714 ],
715 'UI_name' => [
716 'name' => 'UI_name',
717 'field' => [
718 0 => 'name',
719 ],
720 'localizable' => FALSE,
721 'unique' => TRUE,
722 'sig' => 'civicrm_custom_group::1::name',
723 ],
724 ];
725 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
726 }
727
728 }