Regenerate DAOs with readonly attribute for id fields
[civicrm-core.git] / CRM / Event / DAO / Participant.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Event/Participant.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:c9cc760db122ae2f826c169efed061f2)
10 */
11
12 /**
13 * Database access object for the Participant entity.
14 */
15 class CRM_Event_DAO_Participant extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.7';
18 const COMPONENT = 'CiviEvent';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_participant';
26
27 /**
28 * Icon associated with this entity.
29 *
30 * @var string
31 */
32 public static $_icon = 'fa-ticket';
33
34 /**
35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 *
37 * @var bool
38 */
39 public static $_log = TRUE;
40
41 /**
42 * Participant ID
43 *
44 * @var int
45 */
46 public $id;
47
48 /**
49 * FK to Contact ID
50 *
51 * @var int
52 */
53 public $contact_id;
54
55 /**
56 * FK to Event ID
57 *
58 * @var int
59 */
60 public $event_id;
61
62 /**
63 * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.
64 *
65 * @var int
66 */
67 public $status_id;
68
69 /**
70 * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
71 *
72 * @var string
73 */
74 public $role_id;
75
76 /**
77 * When did contact register for event?
78 *
79 * @var datetime
80 */
81 public $register_date;
82
83 /**
84 * Source of this event registration.
85 *
86 * @var string
87 */
88 public $source;
89
90 /**
91 * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
92 * we store the label value and not the key
93 *
94 * @var text
95 */
96 public $fee_level;
97
98 /**
99 * @var bool
100 */
101 public $is_test;
102
103 /**
104 * @var bool
105 */
106 public $is_pay_later;
107
108 /**
109 * actual processor fee if known - may be 0.
110 *
111 * @var float
112 */
113 public $fee_amount;
114
115 /**
116 * FK to Participant ID
117 *
118 * @var int
119 */
120 public $registered_by_id;
121
122 /**
123 * FK to Discount ID
124 *
125 * @var int
126 */
127 public $discount_id;
128
129 /**
130 * 3 character string, value derived from config setting.
131 *
132 * @var string
133 */
134 public $fee_currency;
135
136 /**
137 * The campaign for which this participant has been registered.
138 *
139 * @var int
140 */
141 public $campaign_id;
142
143 /**
144 * Discount Amount
145 *
146 * @var int
147 */
148 public $discount_amount;
149
150 /**
151 * FK to civicrm_event_carts
152 *
153 * @var int
154 */
155 public $cart_id;
156
157 /**
158 * On Waiting List
159 *
160 * @var int
161 */
162 public $must_wait;
163
164 /**
165 * FK to Contact ID
166 *
167 * @var int
168 */
169 public $transferred_to_contact_id;
170
171 /**
172 * Class constructor.
173 */
174 public function __construct() {
175 $this->__table = 'civicrm_participant';
176 parent::__construct();
177 }
178
179 /**
180 * Returns localized title of this entity.
181 *
182 * @param bool $plural
183 * Whether to return the plural version of the title.
184 */
185 public static function getEntityTitle($plural = FALSE) {
186 return $plural ? ts('Participants') : ts('Participant');
187 }
188
189 /**
190 * Returns foreign keys and entity references.
191 *
192 * @return array
193 * [CRM_Core_Reference_Interface]
194 */
195 public static function getReferenceColumns() {
196 if (!isset(Civi::$statics[__CLASS__]['links'])) {
197 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
198 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
199 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_id', 'civicrm_event', 'id');
200 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'status_id', 'civicrm_participant_status_type', 'id');
201 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'registered_by_id', 'civicrm_participant', 'id');
202 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'discount_id', 'civicrm_discount', 'id');
203 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
204 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'cart_id', 'civicrm_event_carts', 'id');
205 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'transferred_to_contact_id', 'civicrm_contact', 'id');
206 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
207 }
208 return Civi::$statics[__CLASS__]['links'];
209 }
210
211 /**
212 * Returns all the column names of this table
213 *
214 * @return array
215 */
216 public static function &fields() {
217 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
218 Civi::$statics[__CLASS__]['fields'] = [
219 'participant_id' => [
220 'name' => 'id',
221 'type' => CRM_Utils_Type::T_INT,
222 'title' => ts('Participant ID'),
223 'description' => ts('Participant ID'),
224 'required' => TRUE,
225 'import' => TRUE,
226 'where' => 'civicrm_participant.id',
227 'headerPattern' => '/(^(participant(.)?)?id$)/i',
228 'export' => TRUE,
229 'table_name' => 'civicrm_participant',
230 'entity' => 'Participant',
231 'bao' => 'CRM_Event_BAO_Participant',
232 'localizable' => 0,
233 'html' => [
234 'type' => 'Number',
235 ],
236 'readonly' => TRUE,
237 'add' => '1.7',
238 ],
239 'participant_contact_id' => [
240 'name' => 'contact_id',
241 'type' => CRM_Utils_Type::T_INT,
242 'title' => ts('Contact ID'),
243 'description' => ts('FK to Contact ID'),
244 'required' => TRUE,
245 'import' => TRUE,
246 'where' => 'civicrm_participant.contact_id',
247 'headerPattern' => '/contact(.?id)?/i',
248 'export' => TRUE,
249 'table_name' => 'civicrm_participant',
250 'entity' => 'Participant',
251 'bao' => 'CRM_Event_BAO_Participant',
252 'localizable' => 0,
253 'FKClassName' => 'CRM_Contact_DAO_Contact',
254 'html' => [
255 'label' => ts("Contact"),
256 ],
257 'add' => '1.7',
258 ],
259 'event_id' => [
260 'name' => 'event_id',
261 'type' => CRM_Utils_Type::T_INT,
262 'title' => ts('Event ID'),
263 'description' => ts('FK to Event ID'),
264 'required' => TRUE,
265 'import' => TRUE,
266 'where' => 'civicrm_participant.event_id',
267 'headerPattern' => '/event id$/i',
268 'export' => TRUE,
269 'table_name' => 'civicrm_participant',
270 'entity' => 'Participant',
271 'bao' => 'CRM_Event_BAO_Participant',
272 'localizable' => 0,
273 'FKClassName' => 'CRM_Event_DAO_Event',
274 'html' => [
275 'label' => ts("Event"),
276 ],
277 'add' => '1.7',
278 ],
279 'participant_status_id' => [
280 'name' => 'status_id',
281 'type' => CRM_Utils_Type::T_INT,
282 'title' => ts('Status ID'),
283 'description' => ts('Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.'),
284 'required' => TRUE,
285 'import' => TRUE,
286 'where' => 'civicrm_participant.status_id',
287 'headerPattern' => '/(participant.)?(status)$/i',
288 'export' => TRUE,
289 'default' => '1',
290 'table_name' => 'civicrm_participant',
291 'entity' => 'Participant',
292 'bao' => 'CRM_Event_BAO_Participant',
293 'localizable' => 0,
294 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
295 'html' => [
296 'type' => 'Select',
297 'label' => ts("Status"),
298 ],
299 'pseudoconstant' => [
300 'table' => 'civicrm_participant_status_type',
301 'keyColumn' => 'id',
302 'labelColumn' => 'label',
303 ],
304 'add' => '1.7',
305 ],
306 'participant_role_id' => [
307 'name' => 'role_id',
308 'type' => CRM_Utils_Type::T_STRING,
309 'title' => ts('Participant Role'),
310 'description' => ts('Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.'),
311 'maxlength' => 128,
312 'size' => CRM_Utils_Type::HUGE,
313 'import' => TRUE,
314 'where' => 'civicrm_participant.role_id',
315 'headerPattern' => '/(participant.)?(role)$/i',
316 'export' => TRUE,
317 'default' => 'NULL',
318 'table_name' => 'civicrm_participant',
319 'entity' => 'Participant',
320 'bao' => 'CRM_Event_BAO_Participant',
321 'localizable' => 0,
322 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
323 'html' => [
324 'type' => 'Select',
325 ],
326 'pseudoconstant' => [
327 'optionGroupName' => 'participant_role',
328 'optionEditPath' => 'civicrm/admin/options/participant_role',
329 ],
330 'add' => '1.7',
331 ],
332 'participant_register_date' => [
333 'name' => 'register_date',
334 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
335 'title' => ts('Register date'),
336 'description' => ts('When did contact register for event?'),
337 'import' => TRUE,
338 'where' => 'civicrm_participant.register_date',
339 'headerPattern' => '/^(r(egister\s)?date)$/i',
340 'export' => TRUE,
341 'table_name' => 'civicrm_participant',
342 'entity' => 'Participant',
343 'bao' => 'CRM_Event_BAO_Participant',
344 'localizable' => 0,
345 'html' => [
346 'type' => 'Select Date',
347 'formatType' => 'activityDateTime',
348 ],
349 'add' => '1.7',
350 ],
351 'participant_source' => [
352 'name' => 'source',
353 'type' => CRM_Utils_Type::T_STRING,
354 'title' => ts('Participant Source'),
355 'description' => ts('Source of this event registration.'),
356 'maxlength' => 128,
357 'size' => CRM_Utils_Type::HUGE,
358 'import' => TRUE,
359 'where' => 'civicrm_participant.source',
360 'headerPattern' => '/(participant.)?(source)$/i',
361 'export' => TRUE,
362 'table_name' => 'civicrm_participant',
363 'entity' => 'Participant',
364 'bao' => 'CRM_Event_BAO_Participant',
365 'localizable' => 0,
366 'html' => [
367 'type' => 'Text',
368 ],
369 'add' => '1.7',
370 ],
371 'participant_fee_level' => [
372 'name' => 'fee_level',
373 'type' => CRM_Utils_Type::T_TEXT,
374 'title' => ts('Fee level'),
375 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
376 we store the label value and not the key'),
377 'import' => TRUE,
378 'where' => 'civicrm_participant.fee_level',
379 'headerPattern' => '/^(f(ee\s)?level)$/i',
380 'export' => TRUE,
381 'table_name' => 'civicrm_participant',
382 'entity' => 'Participant',
383 'bao' => 'CRM_Event_BAO_Participant',
384 'localizable' => 0,
385 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
386 'add' => '1.7',
387 ],
388 'participant_is_test' => [
389 'name' => 'is_test',
390 'type' => CRM_Utils_Type::T_BOOLEAN,
391 'title' => ts('Test'),
392 'import' => TRUE,
393 'where' => 'civicrm_participant.is_test',
394 'export' => TRUE,
395 'default' => '0',
396 'table_name' => 'civicrm_participant',
397 'entity' => 'Participant',
398 'bao' => 'CRM_Event_BAO_Participant',
399 'localizable' => 0,
400 'add' => '1.7',
401 ],
402 'participant_is_pay_later' => [
403 'name' => 'is_pay_later',
404 'type' => CRM_Utils_Type::T_BOOLEAN,
405 'title' => ts('Is Pay Later'),
406 'import' => TRUE,
407 'where' => 'civicrm_participant.is_pay_later',
408 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
409 'export' => TRUE,
410 'default' => '0',
411 'table_name' => 'civicrm_participant',
412 'entity' => 'Participant',
413 'bao' => 'CRM_Event_BAO_Participant',
414 'localizable' => 0,
415 'add' => '2.1',
416 ],
417 'participant_fee_amount' => [
418 'name' => 'fee_amount',
419 'type' => CRM_Utils_Type::T_MONEY,
420 'title' => ts('Fee Amount'),
421 'description' => ts('actual processor fee if known - may be 0.'),
422 'precision' => [
423 20,
424 2,
425 ],
426 'import' => TRUE,
427 'where' => 'civicrm_participant.fee_amount',
428 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
429 'dataPattern' => '/^\d+(\.\d{2})?$/',
430 'export' => TRUE,
431 'table_name' => 'civicrm_participant',
432 'entity' => 'Participant',
433 'bao' => 'CRM_Event_BAO_Participant',
434 'localizable' => 0,
435 'add' => '2.1',
436 ],
437 'participant_registered_by_id' => [
438 'name' => 'registered_by_id',
439 'type' => CRM_Utils_Type::T_INT,
440 'title' => ts('Registered By Participant ID'),
441 'description' => ts('FK to Participant ID'),
442 'import' => TRUE,
443 'where' => 'civicrm_participant.registered_by_id',
444 'export' => TRUE,
445 'default' => 'NULL',
446 'table_name' => 'civicrm_participant',
447 'entity' => 'Participant',
448 'bao' => 'CRM_Event_BAO_Participant',
449 'localizable' => 0,
450 'FKClassName' => 'CRM_Event_DAO_Participant',
451 'html' => [
452 'label' => ts("Registered By"),
453 ],
454 'add' => '2.1',
455 ],
456 'participant_discount_id' => [
457 'name' => 'discount_id',
458 'type' => CRM_Utils_Type::T_INT,
459 'title' => ts('Discount ID'),
460 'description' => ts('FK to Discount ID'),
461 'where' => 'civicrm_participant.discount_id',
462 'default' => 'NULL',
463 'table_name' => 'civicrm_participant',
464 'entity' => 'Participant',
465 'bao' => 'CRM_Event_BAO_Participant',
466 'localizable' => 0,
467 'FKClassName' => 'CRM_Core_DAO_Discount',
468 'html' => [
469 'label' => ts("Discount"),
470 ],
471 'add' => '2.1',
472 ],
473 'participant_fee_currency' => [
474 'name' => 'fee_currency',
475 'type' => CRM_Utils_Type::T_STRING,
476 'title' => ts('Fee Currency'),
477 'description' => ts('3 character string, value derived from config setting.'),
478 'maxlength' => 3,
479 'size' => CRM_Utils_Type::FOUR,
480 'import' => TRUE,
481 'where' => 'civicrm_participant.fee_currency',
482 'headerPattern' => '/(fee)?.?cur(rency)?/i',
483 'dataPattern' => '/^[A-Z]{3}$/i',
484 'export' => TRUE,
485 'default' => 'NULL',
486 'table_name' => 'civicrm_participant',
487 'entity' => 'Participant',
488 'bao' => 'CRM_Event_BAO_Participant',
489 'localizable' => 0,
490 'html' => [
491 'type' => 'Select',
492 ],
493 'pseudoconstant' => [
494 'table' => 'civicrm_currency',
495 'keyColumn' => 'name',
496 'labelColumn' => 'full_name',
497 'nameColumn' => 'name',
498 'abbrColumn' => 'symbol',
499 ],
500 'add' => '3.0',
501 ],
502 'participant_campaign_id' => [
503 'name' => 'campaign_id',
504 'type' => CRM_Utils_Type::T_INT,
505 'title' => ts('Campaign ID'),
506 'description' => ts('The campaign for which this participant has been registered.'),
507 'import' => TRUE,
508 'where' => 'civicrm_participant.campaign_id',
509 'export' => TRUE,
510 'table_name' => 'civicrm_participant',
511 'entity' => 'Participant',
512 'bao' => 'CRM_Event_BAO_Participant',
513 'localizable' => 0,
514 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
515 'html' => [
516 'label' => ts("Campaign"),
517 ],
518 'add' => '3.4',
519 ],
520 'discount_amount' => [
521 'name' => 'discount_amount',
522 'type' => CRM_Utils_Type::T_INT,
523 'title' => ts('Discount Amount'),
524 'description' => ts('Discount Amount'),
525 'where' => 'civicrm_participant.discount_amount',
526 'table_name' => 'civicrm_participant',
527 'entity' => 'Participant',
528 'bao' => 'CRM_Event_BAO_Participant',
529 'localizable' => 0,
530 'add' => '4.1',
531 ],
532 'cart_id' => [
533 'name' => 'cart_id',
534 'type' => CRM_Utils_Type::T_INT,
535 'title' => ts('Event Cart ID'),
536 'description' => ts('FK to civicrm_event_carts'),
537 'where' => 'civicrm_participant.cart_id',
538 'table_name' => 'civicrm_participant',
539 'entity' => 'Participant',
540 'bao' => 'CRM_Event_BAO_Participant',
541 'localizable' => 0,
542 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
543 'html' => [
544 'label' => ts("Event Cart"),
545 ],
546 'add' => '4.1',
547 ],
548 'must_wait' => [
549 'name' => 'must_wait',
550 'type' => CRM_Utils_Type::T_INT,
551 'title' => ts('Must Wait on List'),
552 'description' => ts('On Waiting List'),
553 'where' => 'civicrm_participant.must_wait',
554 'table_name' => 'civicrm_participant',
555 'entity' => 'Participant',
556 'bao' => 'CRM_Event_BAO_Participant',
557 'localizable' => 0,
558 'add' => '4.1',
559 ],
560 'transferred_to_contact_id' => [
561 'name' => 'transferred_to_contact_id',
562 'type' => CRM_Utils_Type::T_INT,
563 'title' => ts('Transferred to Contact ID'),
564 'description' => ts('FK to Contact ID'),
565 'import' => TRUE,
566 'where' => 'civicrm_participant.transferred_to_contact_id',
567 'headerPattern' => '/transfer(.?id)?/i',
568 'export' => TRUE,
569 'default' => 'NULL',
570 'table_name' => 'civicrm_participant',
571 'entity' => 'Participant',
572 'bao' => 'CRM_Event_BAO_Participant',
573 'localizable' => 0,
574 'FKClassName' => 'CRM_Contact_DAO_Contact',
575 'html' => [
576 'label' => ts("Transferred to"),
577 ],
578 'add' => '4.7',
579 ],
580 ];
581 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
582 }
583 return Civi::$statics[__CLASS__]['fields'];
584 }
585
586 /**
587 * Return a mapping from field-name to the corresponding key (as used in fields()).
588 *
589 * @return array
590 * Array(string $name => string $uniqueName).
591 */
592 public static function &fieldKeys() {
593 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
594 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
595 }
596 return Civi::$statics[__CLASS__]['fieldKeys'];
597 }
598
599 /**
600 * Returns the names of this table
601 *
602 * @return string
603 */
604 public static function getTableName() {
605 return self::$_tableName;
606 }
607
608 /**
609 * Returns if this table needs to be logged
610 *
611 * @return bool
612 */
613 public function getLog() {
614 return self::$_log;
615 }
616
617 /**
618 * Returns the list of fields that can be imported
619 *
620 * @param bool $prefix
621 *
622 * @return array
623 */
624 public static function &import($prefix = FALSE) {
625 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant', $prefix, []);
626 return $r;
627 }
628
629 /**
630 * Returns the list of fields that can be exported
631 *
632 * @param bool $prefix
633 *
634 * @return array
635 */
636 public static function &export($prefix = FALSE) {
637 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant', $prefix, []);
638 return $r;
639 }
640
641 /**
642 * Returns the list of indices
643 *
644 * @param bool $localize
645 *
646 * @return array
647 */
648 public static function indices($localize = TRUE) {
649 $indices = [
650 'index_status_id' => [
651 'name' => 'index_status_id',
652 'field' => [
653 0 => 'status_id',
654 ],
655 'localizable' => FALSE,
656 'sig' => 'civicrm_participant::0::status_id',
657 ],
658 'index_role_id' => [
659 'name' => 'index_role_id',
660 'field' => [
661 0 => 'role_id',
662 ],
663 'localizable' => FALSE,
664 'sig' => 'civicrm_participant::0::role_id',
665 ],
666 ];
667 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
668 }
669
670 }