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