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