Add "labelField" metadata to entities
[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:325f7ef398cd08e7576f634d9923f129)
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 * Unique Custom Group ID
42 *
43 * @var int
44 */
45 public $id;
46
47 /**
48 * Variable name/programmatic handle for this group.
49 *
50 * @var string
51 */
52 public $name;
53
54 /**
55 * Friendly Name.
56 *
57 * @var string
58 */
59 public $title;
60
61 /**
62 * Type of object this group extends (can add other options later e.g. contact_address, etc.).
63 *
64 * @var string
65 */
66 public $extends;
67
68 /**
69 * FK to civicrm_option_value.id (for option group custom_data_type.)
70 *
71 * @var int
72 */
73 public $extends_entity_column_id;
74
75 /**
76 * linking custom group for dynamic object
77 *
78 * @var string
79 */
80 public $extends_entity_column_value;
81
82 /**
83 * Visual relationship between this form and its parent.
84 *
85 * @var string
86 */
87 public $style;
88
89 /**
90 * Will this group be in collapsed or expanded mode on initial display ?
91 *
92 * @var bool
93 */
94 public $collapse_display;
95
96 /**
97 * Description and/or help text to display before fields in form.
98 *
99 * @var text
100 */
101 public $help_pre;
102
103 /**
104 * Description and/or help text to display after fields in form.
105 *
106 * @var text
107 */
108 public $help_post;
109
110 /**
111 * Controls display order when multiple extended property groups are setup for the same class.
112 *
113 * @var int
114 */
115 public $weight;
116
117 /**
118 * Is this property active?
119 *
120 * @var bool
121 */
122 public $is_active;
123
124 /**
125 * Name of the table that holds the values for this group.
126 *
127 * @var string
128 */
129 public $table_name;
130
131 /**
132 * Does this group hold multiple values?
133 *
134 * @var bool
135 */
136 public $is_multiple;
137
138 /**
139 * minimum number of multiple records (typically 0?)
140 *
141 * @var int
142 */
143 public $min_multiple;
144
145 /**
146 * maximum number of multiple records, if 0 - no max
147 *
148 * @var int
149 */
150 public $max_multiple;
151
152 /**
153 * Will this group be in collapsed or expanded mode on advanced search display ?
154 *
155 * @var bool
156 */
157 public $collapse_adv_display;
158
159 /**
160 * FK to civicrm_contact, who created this custom group
161 *
162 * @var int
163 */
164 public $created_id;
165
166 /**
167 * Date and time this custom group was created.
168 *
169 * @var datetime
170 */
171 public $created_date;
172
173 /**
174 * Is this a reserved Custom Group?
175 *
176 * @var bool
177 */
178 public $is_reserved;
179
180 /**
181 * Is this property public?
182 *
183 * @var bool
184 */
185 public $is_public;
186
187 /**
188 * crm-i icon class
189 *
190 * @var string
191 */
192 public $icon;
193
194 /**
195 * Class constructor.
196 */
197 public function __construct() {
198 $this->__table = 'civicrm_custom_group';
199 parent::__construct();
200 }
201
202 /**
203 * Returns localized title of this entity.
204 *
205 * @param bool $plural
206 * Whether to return the plural version of the title.
207 */
208 public static function getEntityTitle($plural = FALSE) {
209 return $plural ? ts('Custom Groups') : ts('Custom Group');
210 }
211
212 /**
213 * Returns foreign keys and entity references.
214 *
215 * @return array
216 * [CRM_Core_Reference_Interface]
217 */
218 public static function getReferenceColumns() {
219 if (!isset(Civi::$statics[__CLASS__]['links'])) {
220 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
221 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
222 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
223 }
224 return Civi::$statics[__CLASS__]['links'];
225 }
226
227 /**
228 * Returns all the column names of this table
229 *
230 * @return array
231 */
232 public static function &fields() {
233 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
234 Civi::$statics[__CLASS__]['fields'] = [
235 'id' => [
236 'name' => 'id',
237 'type' => CRM_Utils_Type::T_INT,
238 'title' => ts('Custom Group ID'),
239 'description' => ts('Unique Custom Group ID'),
240 'required' => TRUE,
241 'where' => 'civicrm_custom_group.id',
242 'table_name' => 'civicrm_custom_group',
243 'entity' => 'CustomGroup',
244 'bao' => 'CRM_Core_BAO_CustomGroup',
245 'localizable' => 0,
246 'add' => '1.1',
247 ],
248 'name' => [
249 'name' => 'name',
250 'type' => CRM_Utils_Type::T_STRING,
251 'title' => ts('Custom Group Name'),
252 'description' => ts('Variable name/programmatic handle for this group.'),
253 'maxlength' => 64,
254 'size' => CRM_Utils_Type::BIG,
255 'where' => 'civicrm_custom_group.name',
256 'table_name' => 'civicrm_custom_group',
257 'entity' => 'CustomGroup',
258 'bao' => 'CRM_Core_BAO_CustomGroup',
259 'localizable' => 0,
260 'add' => '1.1',
261 ],
262 'title' => [
263 'name' => 'title',
264 'type' => CRM_Utils_Type::T_STRING,
265 'title' => ts('Custom Group Title'),
266 'description' => ts('Friendly Name.'),
267 'required' => TRUE,
268 'maxlength' => 64,
269 'size' => CRM_Utils_Type::BIG,
270 'where' => 'civicrm_custom_group.title',
271 'table_name' => 'civicrm_custom_group',
272 'entity' => 'CustomGroup',
273 'bao' => 'CRM_Core_BAO_CustomGroup',
274 'localizable' => 1,
275 'add' => '1.1',
276 ],
277 'extends' => [
278 'name' => 'extends',
279 'type' => CRM_Utils_Type::T_STRING,
280 'title' => ts('Custom Group Extends'),
281 'description' => ts('Type of object this group extends (can add other options later e.g. contact_address, etc.).'),
282 'maxlength' => 255,
283 'size' => CRM_Utils_Type::HUGE,
284 'where' => 'civicrm_custom_group.extends',
285 'default' => 'Contact',
286 'table_name' => 'civicrm_custom_group',
287 'entity' => 'CustomGroup',
288 'bao' => 'CRM_Core_BAO_CustomGroup',
289 'localizable' => 0,
290 'add' => '1.1',
291 ],
292 'extends_entity_column_id' => [
293 'name' => 'extends_entity_column_id',
294 'type' => CRM_Utils_Type::T_INT,
295 'title' => ts('Custom Group Subtype List'),
296 'description' => ts('FK to civicrm_option_value.id (for option group custom_data_type.)'),
297 'where' => 'civicrm_custom_group.extends_entity_column_id',
298 'default' => 'NULL',
299 'table_name' => 'civicrm_custom_group',
300 'entity' => 'CustomGroup',
301 'bao' => 'CRM_Core_BAO_CustomGroup',
302 'localizable' => 0,
303 'html' => [
304 'type' => 'Select',
305 ],
306 'pseudoconstant' => [
307 'optionGroupName' => 'custom_data_type',
308 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
309 ],
310 'add' => '2.2',
311 ],
312 'extends_entity_column_value' => [
313 'name' => 'extends_entity_column_value',
314 'type' => CRM_Utils_Type::T_STRING,
315 'title' => ts('Custom Group Subtype'),
316 'description' => ts('linking custom group for dynamic object'),
317 'maxlength' => 255,
318 'size' => CRM_Utils_Type::HUGE,
319 'where' => 'civicrm_custom_group.extends_entity_column_value',
320 'table_name' => 'civicrm_custom_group',
321 'entity' => 'CustomGroup',
322 'bao' => 'CRM_Core_BAO_CustomGroup',
323 'localizable' => 0,
324 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
325 'add' => '1.6',
326 ],
327 'style' => [
328 'name' => 'style',
329 'type' => CRM_Utils_Type::T_STRING,
330 'title' => ts('Custom Group Style'),
331 'description' => ts('Visual relationship between this form and its parent.'),
332 'maxlength' => 15,
333 'size' => CRM_Utils_Type::TWELVE,
334 'where' => 'civicrm_custom_group.style',
335 'table_name' => 'civicrm_custom_group',
336 'entity' => 'CustomGroup',
337 'bao' => 'CRM_Core_BAO_CustomGroup',
338 'localizable' => 0,
339 'html' => [
340 'type' => 'Select',
341 ],
342 'pseudoconstant' => [
343 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
344 ],
345 'add' => '1.1',
346 ],
347 'collapse_display' => [
348 'name' => 'collapse_display',
349 'type' => CRM_Utils_Type::T_BOOLEAN,
350 'title' => ts('Collapse Custom Group?'),
351 'description' => ts('Will this group be in collapsed or expanded mode on initial display ?'),
352 'where' => 'civicrm_custom_group.collapse_display',
353 'default' => '0',
354 'table_name' => 'civicrm_custom_group',
355 'entity' => 'CustomGroup',
356 'bao' => 'CRM_Core_BAO_CustomGroup',
357 'localizable' => 0,
358 'add' => '1.1',
359 ],
360 'help_pre' => [
361 'name' => 'help_pre',
362 'type' => CRM_Utils_Type::T_TEXT,
363 'title' => ts('Custom Group Pre Text'),
364 'description' => ts('Description and/or help text to display before fields in form.'),
365 'rows' => 4,
366 'cols' => 80,
367 'where' => 'civicrm_custom_group.help_pre',
368 'table_name' => 'civicrm_custom_group',
369 'entity' => 'CustomGroup',
370 'bao' => 'CRM_Core_BAO_CustomGroup',
371 'localizable' => 1,
372 'html' => [
373 'type' => 'TextArea',
374 ],
375 'add' => '1.1',
376 ],
377 'help_post' => [
378 'name' => 'help_post',
379 'type' => CRM_Utils_Type::T_TEXT,
380 'title' => ts('Custom Group Post Text'),
381 'description' => ts('Description and/or help text to display after fields in form.'),
382 'rows' => 4,
383 'cols' => 80,
384 'where' => 'civicrm_custom_group.help_post',
385 'table_name' => 'civicrm_custom_group',
386 'entity' => 'CustomGroup',
387 'bao' => 'CRM_Core_BAO_CustomGroup',
388 'localizable' => 1,
389 'html' => [
390 'type' => 'TextArea',
391 ],
392 'add' => '1.1',
393 ],
394 'weight' => [
395 'name' => 'weight',
396 'type' => CRM_Utils_Type::T_INT,
397 'title' => ts('Order'),
398 'description' => ts('Controls display order when multiple extended property groups are setup for the same class.'),
399 'required' => TRUE,
400 'where' => 'civicrm_custom_group.weight',
401 'default' => '1',
402 'table_name' => 'civicrm_custom_group',
403 'entity' => 'CustomGroup',
404 'bao' => 'CRM_Core_BAO_CustomGroup',
405 'localizable' => 0,
406 'add' => '1.1',
407 ],
408 'is_active' => [
409 'name' => 'is_active',
410 'type' => CRM_Utils_Type::T_BOOLEAN,
411 'title' => ts('Custom Group Is Active?'),
412 'description' => ts('Is this property active?'),
413 'where' => 'civicrm_custom_group.is_active',
414 'default' => '1',
415 'table_name' => 'civicrm_custom_group',
416 'entity' => 'CustomGroup',
417 'bao' => 'CRM_Core_BAO_CustomGroup',
418 'localizable' => 0,
419 'add' => '1.1',
420 ],
421 'table_name' => [
422 'name' => 'table_name',
423 'type' => CRM_Utils_Type::T_STRING,
424 'title' => ts('Table Name'),
425 'description' => ts('Name of the table that holds the values for this group.'),
426 'maxlength' => 255,
427 'size' => CRM_Utils_Type::HUGE,
428 'where' => 'civicrm_custom_group.table_name',
429 'table_name' => 'civicrm_custom_group',
430 'entity' => 'CustomGroup',
431 'bao' => 'CRM_Core_BAO_CustomGroup',
432 'localizable' => 0,
433 'add' => '2.0',
434 ],
435 'is_multiple' => [
436 'name' => 'is_multiple',
437 'type' => CRM_Utils_Type::T_BOOLEAN,
438 'title' => ts('Supports Multiple Records'),
439 'description' => ts('Does this group hold multiple values?'),
440 'where' => 'civicrm_custom_group.is_multiple',
441 'default' => '0',
442 'table_name' => 'civicrm_custom_group',
443 'entity' => 'CustomGroup',
444 'bao' => 'CRM_Core_BAO_CustomGroup',
445 'localizable' => 0,
446 'add' => '2.0',
447 ],
448 'min_multiple' => [
449 'name' => 'min_multiple',
450 'type' => CRM_Utils_Type::T_INT,
451 'title' => ts('Minimum Multiple Records'),
452 'description' => ts('minimum number of multiple records (typically 0?)'),
453 'where' => 'civicrm_custom_group.min_multiple',
454 'table_name' => 'civicrm_custom_group',
455 'entity' => 'CustomGroup',
456 'bao' => 'CRM_Core_BAO_CustomGroup',
457 'localizable' => 0,
458 'add' => '2.2',
459 ],
460 'max_multiple' => [
461 'name' => 'max_multiple',
462 'type' => CRM_Utils_Type::T_INT,
463 'title' => ts('Maximum Multiple Records'),
464 'description' => ts('maximum number of multiple records, if 0 - no max'),
465 'where' => 'civicrm_custom_group.max_multiple',
466 'table_name' => 'civicrm_custom_group',
467 'entity' => 'CustomGroup',
468 'bao' => 'CRM_Core_BAO_CustomGroup',
469 'localizable' => 0,
470 'add' => '2.2',
471 ],
472 'collapse_adv_display' => [
473 'name' => 'collapse_adv_display',
474 'type' => CRM_Utils_Type::T_BOOLEAN,
475 'title' => ts('Collapse Group Display'),
476 'description' => ts('Will this group be in collapsed or expanded mode on advanced search display ?'),
477 'where' => 'civicrm_custom_group.collapse_adv_display',
478 'default' => '0',
479 'table_name' => 'civicrm_custom_group',
480 'entity' => 'CustomGroup',
481 'bao' => 'CRM_Core_BAO_CustomGroup',
482 'localizable' => 0,
483 'add' => '3.0',
484 ],
485 'created_id' => [
486 'name' => 'created_id',
487 'type' => CRM_Utils_Type::T_INT,
488 'title' => ts('Custom Group Created By'),
489 'description' => ts('FK to civicrm_contact, who created this custom group'),
490 'where' => 'civicrm_custom_group.created_id',
491 'table_name' => 'civicrm_custom_group',
492 'entity' => 'CustomGroup',
493 'bao' => 'CRM_Core_BAO_CustomGroup',
494 'localizable' => 0,
495 'FKClassName' => 'CRM_Contact_DAO_Contact',
496 'add' => '3.0',
497 ],
498 'created_date' => [
499 'name' => 'created_date',
500 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
501 'title' => ts('Custom Group Created Date'),
502 'description' => ts('Date and time this custom group was created.'),
503 'where' => 'civicrm_custom_group.created_date',
504 'table_name' => 'civicrm_custom_group',
505 'entity' => 'CustomGroup',
506 'bao' => 'CRM_Core_BAO_CustomGroup',
507 'localizable' => 0,
508 'add' => '3.0',
509 ],
510 'is_reserved' => [
511 'name' => 'is_reserved',
512 'type' => CRM_Utils_Type::T_BOOLEAN,
513 'title' => ts('Reserved Group?'),
514 'description' => ts('Is this a reserved Custom Group?'),
515 'where' => 'civicrm_custom_group.is_reserved',
516 'default' => '0',
517 'table_name' => 'civicrm_custom_group',
518 'entity' => 'CustomGroup',
519 'bao' => 'CRM_Core_BAO_CustomGroup',
520 'localizable' => 0,
521 'add' => '4.4',
522 ],
523 'is_public' => [
524 'name' => 'is_public',
525 'type' => CRM_Utils_Type::T_BOOLEAN,
526 'title' => ts('Custom Group Is Public?'),
527 'description' => ts('Is this property public?'),
528 'where' => 'civicrm_custom_group.is_public',
529 'default' => '1',
530 'table_name' => 'civicrm_custom_group',
531 'entity' => 'CustomGroup',
532 'bao' => 'CRM_Core_BAO_CustomGroup',
533 'localizable' => 0,
534 'add' => '4.7',
535 ],
536 'icon' => [
537 'name' => 'icon',
538 'type' => CRM_Utils_Type::T_STRING,
539 'title' => ts('Icon'),
540 'description' => ts('crm-i icon class'),
541 'maxlength' => 255,
542 'size' => CRM_Utils_Type::HUGE,
543 'where' => 'civicrm_custom_group.icon',
544 'default' => 'NULL',
545 'table_name' => 'civicrm_custom_group',
546 'entity' => 'CustomGroup',
547 'bao' => 'CRM_Core_BAO_CustomGroup',
548 'localizable' => 0,
549 'add' => '5.28',
550 ],
551 ];
552 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
553 }
554 return Civi::$statics[__CLASS__]['fields'];
555 }
556
557 /**
558 * Return a mapping from field-name to the corresponding key (as used in fields()).
559 *
560 * @return array
561 * Array(string $name => string $uniqueName).
562 */
563 public static function &fieldKeys() {
564 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
565 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
566 }
567 return Civi::$statics[__CLASS__]['fieldKeys'];
568 }
569
570 /**
571 * Returns the names of this table
572 *
573 * @return string
574 */
575 public static function getTableName() {
576 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
577 }
578
579 /**
580 * Returns if this table needs to be logged
581 *
582 * @return bool
583 */
584 public function getLog() {
585 return self::$_log;
586 }
587
588 /**
589 * Returns the list of fields that can be imported
590 *
591 * @param bool $prefix
592 *
593 * @return array
594 */
595 public static function &import($prefix = FALSE) {
596 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []);
597 return $r;
598 }
599
600 /**
601 * Returns the list of fields that can be exported
602 *
603 * @param bool $prefix
604 *
605 * @return array
606 */
607 public static function &export($prefix = FALSE) {
608 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []);
609 return $r;
610 }
611
612 /**
613 * Returns the list of indices
614 *
615 * @param bool $localize
616 *
617 * @return array
618 */
619 public static function indices($localize = TRUE) {
620 $indices = [
621 'UI_title_extends' => [
622 'name' => 'UI_title_extends',
623 'field' => [
624 0 => 'title',
625 1 => 'extends',
626 ],
627 'localizable' => TRUE,
628 'unique' => TRUE,
629 'sig' => 'civicrm_custom_group::1::title::extends',
630 ],
631 'UI_name_extends' => [
632 'name' => 'UI_name_extends',
633 'field' => [
634 0 => 'name',
635 1 => 'extends',
636 ],
637 'localizable' => FALSE,
638 'unique' => TRUE,
639 'sig' => 'civicrm_custom_group::1::name::extends',
640 ],
641 ];
642 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
643 }
644
645 }