Convert remaining Authorize.net test to use guzzle
[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:1e40fdbcc363c9b5e4c880a6838c7375)
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 int
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 int
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 * 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' => ts('Unique Custom Group ID'),
214 'required' => TRUE,
215 'where' => 'civicrm_custom_group.id',
216 'table_name' => 'civicrm_custom_group',
217 'entity' => 'CustomGroup',
218 'bao' => 'CRM_Core_BAO_CustomGroup',
219 'localizable' => 0,
220 ],
221 'name' => [
222 'name' => 'name',
223 'type' => CRM_Utils_Type::T_STRING,
224 'title' => ts('Custom Group Name'),
225 'description' => ts('Variable name/programmatic handle for this group.'),
226 'maxlength' => 64,
227 'size' => CRM_Utils_Type::BIG,
228 'where' => 'civicrm_custom_group.name',
229 'table_name' => 'civicrm_custom_group',
230 'entity' => 'CustomGroup',
231 'bao' => 'CRM_Core_BAO_CustomGroup',
232 'localizable' => 0,
233 ],
234 'title' => [
235 'name' => 'title',
236 'type' => CRM_Utils_Type::T_STRING,
237 'title' => ts('Custom Group Title'),
238 'description' => ts('Friendly Name.'),
239 'required' => TRUE,
240 'maxlength' => 64,
241 'size' => CRM_Utils_Type::BIG,
242 'where' => 'civicrm_custom_group.title',
243 'table_name' => 'civicrm_custom_group',
244 'entity' => 'CustomGroup',
245 'bao' => 'CRM_Core_BAO_CustomGroup',
246 'localizable' => 1,
247 ],
248 'extends' => [
249 'name' => 'extends',
250 'type' => CRM_Utils_Type::T_STRING,
251 'title' => ts('Custom Group Extends'),
252 'description' => ts('Type of object this group extends (can add other options later e.g. contact_address, etc.).'),
253 'maxlength' => 255,
254 'size' => CRM_Utils_Type::HUGE,
255 'where' => 'civicrm_custom_group.extends',
256 'default' => 'Contact',
257 'table_name' => 'civicrm_custom_group',
258 'entity' => 'CustomGroup',
259 'bao' => 'CRM_Core_BAO_CustomGroup',
260 'localizable' => 0,
261 ],
262 'extends_entity_column_id' => [
263 'name' => 'extends_entity_column_id',
264 'type' => CRM_Utils_Type::T_INT,
265 'title' => ts('Custom Group Subtype List'),
266 'description' => ts('FK to civicrm_option_value.id (for option group custom_data_type.)'),
267 'where' => 'civicrm_custom_group.extends_entity_column_id',
268 'default' => 'NULL',
269 'table_name' => 'civicrm_custom_group',
270 'entity' => 'CustomGroup',
271 'bao' => 'CRM_Core_BAO_CustomGroup',
272 'localizable' => 0,
273 'html' => [
274 'type' => 'Select',
275 ],
276 'pseudoconstant' => [
277 'optionGroupName' => 'custom_data_type',
278 'optionEditPath' => 'civicrm/admin/options/custom_data_type',
279 ],
280 ],
281 'extends_entity_column_value' => [
282 'name' => 'extends_entity_column_value',
283 'type' => CRM_Utils_Type::T_STRING,
284 'title' => ts('Custom Group Subtype'),
285 'description' => ts('linking custom group for dynamic object'),
286 'maxlength' => 255,
287 'size' => CRM_Utils_Type::HUGE,
288 'where' => 'civicrm_custom_group.extends_entity_column_value',
289 'table_name' => 'civicrm_custom_group',
290 'entity' => 'CustomGroup',
291 'bao' => 'CRM_Core_BAO_CustomGroup',
292 'localizable' => 0,
293 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
294 ],
295 'style' => [
296 'name' => 'style',
297 'type' => CRM_Utils_Type::T_STRING,
298 'title' => ts('Custom Group Style'),
299 'description' => ts('Visual relationship between this form and its parent.'),
300 'maxlength' => 15,
301 'size' => CRM_Utils_Type::TWELVE,
302 'where' => 'civicrm_custom_group.style',
303 'table_name' => 'civicrm_custom_group',
304 'entity' => 'CustomGroup',
305 'bao' => 'CRM_Core_BAO_CustomGroup',
306 'localizable' => 0,
307 'html' => [
308 'type' => 'Select',
309 ],
310 'pseudoconstant' => [
311 'callback' => 'CRM_Core_SelectValues::customGroupStyle',
312 ],
313 ],
314 'collapse_display' => [
315 'name' => 'collapse_display',
316 'type' => CRM_Utils_Type::T_INT,
317 'title' => ts('Collapse Custom Group?'),
318 'description' => ts('Will this group be in collapsed or expanded mode on initial display ?'),
319 'where' => 'civicrm_custom_group.collapse_display',
320 'default' => '0',
321 'table_name' => 'civicrm_custom_group',
322 'entity' => 'CustomGroup',
323 'bao' => 'CRM_Core_BAO_CustomGroup',
324 'localizable' => 0,
325 ],
326 'help_pre' => [
327 'name' => 'help_pre',
328 'type' => CRM_Utils_Type::T_TEXT,
329 'title' => ts('Custom Group Pre Text'),
330 'description' => ts('Description and/or help text to display before fields in form.'),
331 'rows' => 4,
332 'cols' => 80,
333 'where' => 'civicrm_custom_group.help_pre',
334 'table_name' => 'civicrm_custom_group',
335 'entity' => 'CustomGroup',
336 'bao' => 'CRM_Core_BAO_CustomGroup',
337 'localizable' => 1,
338 'html' => [
339 'type' => 'TextArea',
340 ],
341 ],
342 'help_post' => [
343 'name' => 'help_post',
344 'type' => CRM_Utils_Type::T_TEXT,
345 'title' => ts('Custom Group Post Text'),
346 'description' => ts('Description and/or help text to display after fields in form.'),
347 'rows' => 4,
348 'cols' => 80,
349 'where' => 'civicrm_custom_group.help_post',
350 'table_name' => 'civicrm_custom_group',
351 'entity' => 'CustomGroup',
352 'bao' => 'CRM_Core_BAO_CustomGroup',
353 'localizable' => 1,
354 'html' => [
355 'type' => 'TextArea',
356 ],
357 ],
358 'weight' => [
359 'name' => 'weight',
360 'type' => CRM_Utils_Type::T_INT,
361 'title' => ts('Order'),
362 'description' => ts('Controls display order when multiple extended property groups are setup for the same class.'),
363 'required' => TRUE,
364 'where' => 'civicrm_custom_group.weight',
365 'default' => '1',
366 'table_name' => 'civicrm_custom_group',
367 'entity' => 'CustomGroup',
368 'bao' => 'CRM_Core_BAO_CustomGroup',
369 'localizable' => 0,
370 ],
371 'is_active' => [
372 'name' => 'is_active',
373 'type' => CRM_Utils_Type::T_BOOLEAN,
374 'title' => ts('Custom Group Is Active?'),
375 'description' => ts('Is this property active?'),
376 'where' => 'civicrm_custom_group.is_active',
377 'default' => '1',
378 'table_name' => 'civicrm_custom_group',
379 'entity' => 'CustomGroup',
380 'bao' => 'CRM_Core_BAO_CustomGroup',
381 'localizable' => 0,
382 ],
383 'table_name' => [
384 'name' => 'table_name',
385 'type' => CRM_Utils_Type::T_STRING,
386 'title' => ts('Table Name'),
387 'description' => ts('Name of the table that holds the values for this group.'),
388 'maxlength' => 255,
389 'size' => CRM_Utils_Type::HUGE,
390 'where' => 'civicrm_custom_group.table_name',
391 'table_name' => 'civicrm_custom_group',
392 'entity' => 'CustomGroup',
393 'bao' => 'CRM_Core_BAO_CustomGroup',
394 'localizable' => 0,
395 ],
396 'is_multiple' => [
397 'name' => 'is_multiple',
398 'type' => CRM_Utils_Type::T_BOOLEAN,
399 'title' => ts('Supports Multiple Records'),
400 'description' => ts('Does this group hold multiple values?'),
401 'where' => 'civicrm_custom_group.is_multiple',
402 'default' => '0',
403 'table_name' => 'civicrm_custom_group',
404 'entity' => 'CustomGroup',
405 'bao' => 'CRM_Core_BAO_CustomGroup',
406 'localizable' => 0,
407 ],
408 'min_multiple' => [
409 'name' => 'min_multiple',
410 'type' => CRM_Utils_Type::T_INT,
411 'title' => ts('Minimum Multiple Records'),
412 'description' => ts('minimum number of multiple records (typically 0?)'),
413 'where' => 'civicrm_custom_group.min_multiple',
414 'table_name' => 'civicrm_custom_group',
415 'entity' => 'CustomGroup',
416 'bao' => 'CRM_Core_BAO_CustomGroup',
417 'localizable' => 0,
418 ],
419 'max_multiple' => [
420 'name' => 'max_multiple',
421 'type' => CRM_Utils_Type::T_INT,
422 'title' => ts('Maximum Multiple Records'),
423 'description' => ts('maximum number of multiple records, if 0 - no max'),
424 'where' => 'civicrm_custom_group.max_multiple',
425 'table_name' => 'civicrm_custom_group',
426 'entity' => 'CustomGroup',
427 'bao' => 'CRM_Core_BAO_CustomGroup',
428 'localizable' => 0,
429 ],
430 'collapse_adv_display' => [
431 'name' => 'collapse_adv_display',
432 'type' => CRM_Utils_Type::T_INT,
433 'title' => ts('Collapse Group Display'),
434 'description' => ts('Will this group be in collapsed or expanded mode on advanced search display ?'),
435 'where' => 'civicrm_custom_group.collapse_adv_display',
436 'default' => '0',
437 'table_name' => 'civicrm_custom_group',
438 'entity' => 'CustomGroup',
439 'bao' => 'CRM_Core_BAO_CustomGroup',
440 'localizable' => 0,
441 ],
442 'created_id' => [
443 'name' => 'created_id',
444 'type' => CRM_Utils_Type::T_INT,
445 'title' => ts('Custom Group Created By'),
446 'description' => ts('FK to civicrm_contact, who created this custom group'),
447 'where' => 'civicrm_custom_group.created_id',
448 'table_name' => 'civicrm_custom_group',
449 'entity' => 'CustomGroup',
450 'bao' => 'CRM_Core_BAO_CustomGroup',
451 'localizable' => 0,
452 'FKClassName' => 'CRM_Contact_DAO_Contact',
453 ],
454 'created_date' => [
455 'name' => 'created_date',
456 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
457 'title' => ts('Custom Group Created Date'),
458 'description' => ts('Date and time this custom group was created.'),
459 'where' => 'civicrm_custom_group.created_date',
460 'table_name' => 'civicrm_custom_group',
461 'entity' => 'CustomGroup',
462 'bao' => 'CRM_Core_BAO_CustomGroup',
463 'localizable' => 0,
464 ],
465 'is_reserved' => [
466 'name' => 'is_reserved',
467 'type' => CRM_Utils_Type::T_BOOLEAN,
468 'title' => ts('Reserved Group?'),
469 'description' => ts('Is this a reserved Custom Group?'),
470 'where' => 'civicrm_custom_group.is_reserved',
471 'default' => '0',
472 'table_name' => 'civicrm_custom_group',
473 'entity' => 'CustomGroup',
474 'bao' => 'CRM_Core_BAO_CustomGroup',
475 'localizable' => 0,
476 ],
477 'is_public' => [
478 'name' => 'is_public',
479 'type' => CRM_Utils_Type::T_BOOLEAN,
480 'title' => ts('Custom Group Is Public?'),
481 'description' => ts('Is this property public?'),
482 'where' => 'civicrm_custom_group.is_public',
483 'default' => '1',
484 'table_name' => 'civicrm_custom_group',
485 'entity' => 'CustomGroup',
486 'bao' => 'CRM_Core_BAO_CustomGroup',
487 'localizable' => 0,
488 ],
489 ];
490 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
491 }
492 return Civi::$statics[__CLASS__]['fields'];
493 }
494
495 /**
496 * Return a mapping from field-name to the corresponding key (as used in fields()).
497 *
498 * @return array
499 * Array(string $name => string $uniqueName).
500 */
501 public static function &fieldKeys() {
502 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
503 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
504 }
505 return Civi::$statics[__CLASS__]['fieldKeys'];
506 }
507
508 /**
509 * Returns the names of this table
510 *
511 * @return string
512 */
513 public static function getTableName() {
514 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
515 }
516
517 /**
518 * Returns if this table needs to be logged
519 *
520 * @return bool
521 */
522 public function getLog() {
523 return self::$_log;
524 }
525
526 /**
527 * Returns the list of fields that can be imported
528 *
529 * @param bool $prefix
530 *
531 * @return array
532 */
533 public static function &import($prefix = FALSE) {
534 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, []);
535 return $r;
536 }
537
538 /**
539 * Returns the list of fields that can be exported
540 *
541 * @param bool $prefix
542 *
543 * @return array
544 */
545 public static function &export($prefix = FALSE) {
546 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, []);
547 return $r;
548 }
549
550 /**
551 * Returns the list of indices
552 *
553 * @param bool $localize
554 *
555 * @return array
556 */
557 public static function indices($localize = TRUE) {
558 $indices = [
559 'UI_title_extends' => [
560 'name' => 'UI_title_extends',
561 'field' => [
562 0 => 'title',
563 1 => 'extends',
564 ],
565 'localizable' => TRUE,
566 'unique' => TRUE,
567 'sig' => 'civicrm_custom_group::1::title::extends',
568 ],
569 'UI_name_extends' => [
570 'name' => 'UI_name_extends',
571 'field' => [
572 0 => 'name',
573 1 => 'extends',
574 ],
575 'localizable' => FALSE,
576 'unique' => TRUE,
577 'sig' => 'civicrm_custom_group::1::name::extends',
578 ],
579 ];
580 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
581 }
582
583 }