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