Delete entities in the reverse order that they were created
[civicrm-core.git] / CRM / Core / DAO / CustomGroup.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Core/CustomGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:6b88842459aadee0598c08bd4d7518f2)
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 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 static $_log = TRUE;
30
31 /**
32 * Unique Custom Group ID
33 *
34 * @var int unsigned
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 unsigned
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 int unsigned
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 boolean
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 boolean
126 */
127 public $is_multiple;
128
129 /**
130 * minimum number of multiple records (typically 0?)
131 *
132 * @var int unsigned
133 */
134 public $min_multiple;
135
136 /**
137 * maximum number of multiple records, if 0 - no max
138 *
139 * @var int unsigned
140 */
141 public $max_multiple;
142
143 /**
144 * Will this group be in collapsed or expanded mode on advanced search display ?
145 *
146 * @var int unsigned
147 */
148 public $collapse_adv_display;
149
150 /**
151 * FK to civicrm_contact, who created this custom group
152 *
153 * @var int unsigned
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 boolean
168 */
169 public $is_reserved;
170
171 /**
172 * Is this property public?
173 *
174 * @var boolean
175 */
176 public $is_public;
177
178 /**
179 * Class constructor.
180 */
181 public function __construct() {
182 $this->__table = 'civicrm_custom_group';
183 parent::__construct();
184 }
185
186 /**
187 * Returns foreign keys and entity references.
188 *
189 * @return array
190 * [CRM_Core_Reference_Interface]
191 */
192 public static function getReferenceColumns() {
193 if (!isset(Civi::$statics[__CLASS__]['links'])) {
194 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
195 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
196 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
197 }
198 return Civi::$statics[__CLASS__]['links'];
199 }
200
201 /**
202 * Returns all the column names of this table
203 *
204 * @return array
205 */
206 public static function &fields() {
207 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
208 Civi::$statics[__CLASS__]['fields'] = [
209 'id' => [
210 'name' => 'id',
211 'type' => CRM_Utils_Type::T_INT,
212 'title' => ts('Custom Group ID'),
213 'description' => 'Unique Custom Group ID',
214 'required' => TRUE,
215 'table_name' => 'civicrm_custom_group',
216 'entity' => 'CustomGroup',
217 'bao' => 'CRM_Core_BAO_CustomGroup',
218 'localizable' => 0,
219 ],
220 'name' => [
221 'name' => 'name',
222 'type' => CRM_Utils_Type::T_STRING,
223 'title' => ts('Custom Group Name'),
224 'description' => 'Variable name/programmatic handle for this group.',
225 'maxlength' => 64,
226 'size' => CRM_Utils_Type::BIG,
227 'table_name' => 'civicrm_custom_group',
228 'entity' => 'CustomGroup',
229 'bao' => 'CRM_Core_BAO_CustomGroup',
230 'localizable' => 0,
231 ],
232 'title' => [
233 'name' => 'title',
234 'type' => CRM_Utils_Type::T_STRING,
235 'title' => ts('Custom Group Title'),
236 'description' => 'Friendly Name.',
237 'required' => TRUE,
238 'maxlength' => 64,
239 'size' => CRM_Utils_Type::BIG,
240 'table_name' => 'civicrm_custom_group',
241 'entity' => 'CustomGroup',
242 'bao' => 'CRM_Core_BAO_CustomGroup',
243 'localizable' => 1,
244 ],
245 'extends' => [
246 'name' => 'extends',
247 'type' => CRM_Utils_Type::T_STRING,
248 'title' => ts('Custom Group Extends'),
249 'description' => 'Type of object this group extends (can add other options later e.g. contact_address, etc.).',
250 'maxlength' => 255,
251 'size' => CRM_Utils_Type::HUGE,
252 'default' => 'Contact',
253 'table_name' => 'civicrm_custom_group',
254 'entity' => 'CustomGroup',
255 'bao' => 'CRM_Core_BAO_CustomGroup',
256 'localizable' => 0,
257 ],
258 'extends_entity_column_id' => [
259 'name' => 'extends_entity_column_id',
260 'type' => CRM_Utils_Type::T_INT,
261 'title' => ts('Custom Group Subtype List'),
262 'description' => 'FK to civicrm_option_value.id (for option group custom_data_type.)',
263 'default' => 'NULL',
264 'table_name' => 'civicrm_custom_group',
265 'entity' => 'CustomGroup',
266 'bao' => 'CRM_Core_BAO_CustomGroup',
267 'localizable' => 0,
268 'html' => [
269 'type' => 'Select',
270 ],
271 'pseudoconstant' => [
272 'optionGroupName' => 'custom_data_type',
273 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
274 ]
275 ],
276 'extends_entity_column_value' => [
277 'name' => 'extends_entity_column_value',
278 'type' => CRM_Utils_Type::T_STRING,
279 'title' => ts('Custom Group Subtype'),
280 'description' => 'linking custom group for dynamic object',
281 'maxlength' => 255,
282 'size' => CRM_Utils_Type::HUGE,
283 'table_name' => 'civicrm_custom_group',
284 'entity' => 'CustomGroup',
285 'bao' => 'CRM_Core_BAO_CustomGroup',
286 'localizable' => 0,
287 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
288 ],
289 'style' => [
290 'name' => 'style',
291 'type' => CRM_Utils_Type::T_STRING,
292 'title' => ts('Custom Group Style'),
293 'description' => 'Visual relationship between this form and its parent.',
294 'maxlength' => 15,
295 'size' => CRM_Utils_Type::TWELVE,
296 'table_name' => 'civicrm_custom_group',
297 'entity' => 'CustomGroup',
298 'bao' => 'CRM_Core_BAO_CustomGroup',
299 'localizable' => 0,
300 'html' => [
301 'type' => 'Select',
302 ],
303 'pseudoconstant' => [
304 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
305 ]
306 ],
307 'collapse_display' => [
308 'name' => 'collapse_display',
309 'type' => CRM_Utils_Type::T_INT,
310 'title' => ts('Collapse Custom Group?'),
311 'description' => 'Will this group be in collapsed or expanded mode on initial display ?',
312 'table_name' => 'civicrm_custom_group',
313 'entity' => 'CustomGroup',
314 'bao' => 'CRM_Core_BAO_CustomGroup',
315 'localizable' => 0,
316 ],
317 'help_pre' => [
318 'name' => 'help_pre',
319 'type' => CRM_Utils_Type::T_TEXT,
320 'title' => ts('Custom Group Pre Text'),
321 'description' => 'Description and/or help text to display before fields in form.',
322 'rows' => 4,
323 'cols' => 80,
324 'table_name' => 'civicrm_custom_group',
325 'entity' => 'CustomGroup',
326 'bao' => 'CRM_Core_BAO_CustomGroup',
327 'localizable' => 1,
328 'html' => [
329 'type' => 'TextArea',
330 ],
331 ],
332 'help_post' => [
333 'name' => 'help_post',
334 'type' => CRM_Utils_Type::T_TEXT,
335 'title' => ts('Custom Group Post Text'),
336 'description' => 'Description and/or help text to display after fields in form.',
337 'rows' => 4,
338 'cols' => 80,
339 'table_name' => 'civicrm_custom_group',
340 'entity' => 'CustomGroup',
341 'bao' => 'CRM_Core_BAO_CustomGroup',
342 'localizable' => 1,
343 'html' => [
344 'type' => 'TextArea',
345 ],
346 ],
347 'weight' => [
348 'name' => 'weight',
349 'type' => CRM_Utils_Type::T_INT,
350 'title' => ts('Order'),
351 'description' => 'Controls display order when multiple extended property groups are setup for the same class.',
352 'required' => TRUE,
353 'default' => '1',
354 'table_name' => 'civicrm_custom_group',
355 'entity' => 'CustomGroup',
356 'bao' => 'CRM_Core_BAO_CustomGroup',
357 'localizable' => 0,
358 ],
359 'is_active' => [
360 'name' => 'is_active',
361 'type' => CRM_Utils_Type::T_BOOLEAN,
362 'title' => ts('Custom Group Is Active?'),
363 'description' => 'Is this property active?',
364 'default' => '1',
365 'table_name' => 'civicrm_custom_group',
366 'entity' => 'CustomGroup',
367 'bao' => 'CRM_Core_BAO_CustomGroup',
368 'localizable' => 0,
369 ],
370 'table_name' => [
371 'name' => 'table_name',
372 'type' => CRM_Utils_Type::T_STRING,
373 'title' => ts('Table Name'),
374 'description' => 'Name of the table that holds the values for this group.',
375 'maxlength' => 255,
376 'size' => CRM_Utils_Type::HUGE,
377 'table_name' => 'civicrm_custom_group',
378 'entity' => 'CustomGroup',
379 'bao' => 'CRM_Core_BAO_CustomGroup',
380 'localizable' => 0,
381 ],
382 'is_multiple' => [
383 'name' => 'is_multiple',
384 'type' => CRM_Utils_Type::T_BOOLEAN,
385 'title' => ts('Supports Multiple Records'),
386 'description' => 'Does this group hold multiple values?',
387 'table_name' => 'civicrm_custom_group',
388 'entity' => 'CustomGroup',
389 'bao' => 'CRM_Core_BAO_CustomGroup',
390 'localizable' => 0,
391 ],
392 'min_multiple' => [
393 'name' => 'min_multiple',
394 'type' => CRM_Utils_Type::T_INT,
395 'title' => ts('Minimum Multiple Records'),
396 'description' => 'minimum number of multiple records (typically 0?)',
397 'table_name' => 'civicrm_custom_group',
398 'entity' => 'CustomGroup',
399 'bao' => 'CRM_Core_BAO_CustomGroup',
400 'localizable' => 0,
401 ],
402 'max_multiple' => [
403 'name' => 'max_multiple',
404 'type' => CRM_Utils_Type::T_INT,
405 'title' => ts('Maximum Multiple Records'),
406 'description' => 'maximum number of multiple records, if 0 - no max',
407 'table_name' => 'civicrm_custom_group',
408 'entity' => 'CustomGroup',
409 'bao' => 'CRM_Core_BAO_CustomGroup',
410 'localizable' => 0,
411 ],
412 'collapse_adv_display' => [
413 'name' => 'collapse_adv_display',
414 'type' => CRM_Utils_Type::T_INT,
415 'title' => ts('Collapse Group Display'),
416 'description' => 'Will this group be in collapsed or expanded mode on advanced search display ?',
417 'table_name' => 'civicrm_custom_group',
418 'entity' => 'CustomGroup',
419 'bao' => 'CRM_Core_BAO_CustomGroup',
420 'localizable' => 0,
421 ],
422 'created_id' => [
423 'name' => 'created_id',
424 'type' => CRM_Utils_Type::T_INT,
425 'title' => ts('Custom Group Created By'),
426 'description' => 'FK to civicrm_contact, who created this custom group',
427 'table_name' => 'civicrm_custom_group',
428 'entity' => 'CustomGroup',
429 'bao' => 'CRM_Core_BAO_CustomGroup',
430 'localizable' => 0,
431 'FKClassName' => 'CRM_Contact_DAO_Contact',
432 ],
433 'created_date' => [
434 'name' => 'created_date',
435 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
436 'title' => ts('Custom Group Created Date'),
437 'description' => 'Date and time this custom group was created.',
438 'table_name' => 'civicrm_custom_group',
439 'entity' => 'CustomGroup',
440 'bao' => 'CRM_Core_BAO_CustomGroup',
441 'localizable' => 0,
442 ],
443 'is_reserved' => [
444 'name' => 'is_reserved',
445 'type' => CRM_Utils_Type::T_BOOLEAN,
446 'title' => ts('Reserved Group?'),
447 'description' => 'Is this a reserved Custom Group?',
448 'table_name' => 'civicrm_custom_group',
449 'entity' => 'CustomGroup',
450 'bao' => 'CRM_Core_BAO_CustomGroup',
451 'localizable' => 0,
452 ],
453 'is_public' => [
454 'name' => 'is_public',
455 'type' => CRM_Utils_Type::T_BOOLEAN,
456 'title' => ts('Custom Group Is Public?'),
457 'description' => 'Is this property public?',
458 'default' => '1',
459 'table_name' => 'civicrm_custom_group',
460 'entity' => 'CustomGroup',
461 'bao' => 'CRM_Core_BAO_CustomGroup',
462 'localizable' => 0,
463 ],
464 ];
465 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
466 }
467 return Civi::$statics[__CLASS__]['fields'];
468 }
469
470 /**
471 * Return a mapping from field-name to the corresponding key (as used in fields()).
472 *
473 * @return array
474 * Array(string $name => string $uniqueName).
475 */
476 public static function &fieldKeys() {
477 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
478 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
479 }
480 return Civi::$statics[__CLASS__]['fieldKeys'];
481 }
482
483 /**
484 * Returns the names of this table
485 *
486 * @return string
487 */
488 public static function getTableName() {
489 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
490 }
491
492 /**
493 * Returns if this table needs to be logged
494 *
495 * @return bool
496 */
497 public function getLog() {
498 return self::$_log;
499 }
500
501 /**
502 * Returns the list of fields that can be imported
503 *
504 * @param bool $prefix
505 *
506 * @return array
507 */
508 public static function &import($prefix = FALSE) {
509 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []);
510 return $r;
511 }
512
513 /**
514 * Returns the list of fields that can be exported
515 *
516 * @param bool $prefix
517 *
518 * @return array
519 */
520 public static function &export($prefix = FALSE) {
521 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []);
522 return $r;
523 }
524
525 /**
526 * Returns the list of indices
527 *
528 * @param bool $localize
529 *
530 * @return array
531 */
532 public static function indices($localize = TRUE) {
533 $indices = [
534 'UI_title_extends' => [
535 'name' => 'UI_title_extends',
536 'field' => [
537 0 => 'title',
538 1 => 'extends',
539 ],
540 'localizable' => TRUE,
541 'unique' => TRUE,
542 'sig' => 'civicrm_custom_group::1::title::extends',
543 ],
544 'UI_name_extends' => [
545 'name' => 'UI_name_extends',
546 'field' => [
547 0 => 'name',
548 1 => 'extends',
549 ],
550 'localizable' => FALSE,
551 'unique' => TRUE,
552 'sig' => 'civicrm_custom_group::1::name::extends',
553 ],
554 ];
555 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
556 }
557
558 }