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