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