Add "labelField" metadata to entities
[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
8ab43c93 9 * (GenCodeChecksum:a746f8f8a28c6f945abbba148794d2c2)
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
TO
41 /**
42 * Participant Id
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
e501603b 189 /**
f41f0342 190 * Returns foreign keys and entity references.
e501603b
TO
191 *
192 * @return array
193 * [CRM_Core_Reference_Interface]
194 */
c3fc2621 195 public static function getReferenceColumns() {
346aaaba 196 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 197 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
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');
346aaaba 206 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 207 }
346aaaba 208 return Civi::$statics[__CLASS__]['links'];
e501603b 209 }
c3fc2621 210
e501603b
TO
211 /**
212 * Returns all the column names of this table
213 *
214 * @return array
215 */
c3fc2621 216 public static function &fields() {
346aaaba 217 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
218 Civi::$statics[__CLASS__]['fields'] = [
219 'participant_id' => [
e501603b
TO
220 'name' => 'id',
221 'type' => CRM_Utils_Type::T_INT,
c3fc2621 222 'title' => ts('Participant ID'),
215b423e 223 'description' => ts('Participant Id'),
c3fc2621
CW
224 'required' => TRUE,
225 'import' => TRUE,
e501603b
TO
226 'where' => 'civicrm_participant.id',
227 'headerPattern' => '/(^(participant(.)?)?id$)/i',
c3fc2621 228 'export' => TRUE,
522a26c9 229 'table_name' => 'civicrm_participant',
230 'entity' => 'Participant',
231 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 232 'localizable' => 0,
a9d0587b 233 'add' => '1.7',
c3fc2621
CW
234 ],
235 'participant_contact_id' => [
e501603b
TO
236 'name' => 'contact_id',
237 'type' => CRM_Utils_Type::T_INT,
c3fc2621 238 'title' => ts('Contact ID'),
215b423e 239 'description' => ts('FK to Contact ID'),
c3fc2621
CW
240 'required' => TRUE,
241 'import' => TRUE,
e501603b
TO
242 'where' => 'civicrm_participant.contact_id',
243 'headerPattern' => '/contact(.?id)?/i',
c3fc2621 244 'export' => TRUE,
522a26c9 245 'table_name' => 'civicrm_participant',
246 'entity' => 'Participant',
247 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 248 'localizable' => 0,
e501603b 249 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 250 'add' => '1.7',
c3fc2621
CW
251 ],
252 'event_id' => [
e501603b
TO
253 'name' => 'event_id',
254 'type' => CRM_Utils_Type::T_INT,
c3fc2621 255 'title' => ts('Event'),
215b423e 256 'description' => ts('FK to Event ID'),
c3fc2621
CW
257 'required' => TRUE,
258 'import' => TRUE,
e501603b
TO
259 'where' => 'civicrm_participant.event_id',
260 'headerPattern' => '/event id$/i',
c3fc2621 261 'export' => TRUE,
522a26c9 262 'table_name' => 'civicrm_participant',
263 'entity' => 'Participant',
264 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 265 'localizable' => 0,
e501603b 266 'FKClassName' => 'CRM_Event_DAO_Event',
a9d0587b 267 'add' => '1.7',
c3fc2621
CW
268 ],
269 'participant_status_id' => [
e501603b
TO
270 'name' => 'status_id',
271 'type' => CRM_Utils_Type::T_INT,
c3fc2621 272 'title' => ts('Participant Status'),
215b423e 273 'description' => ts('Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.'),
c3fc2621
CW
274 'required' => TRUE,
275 'import' => TRUE,
e501603b
TO
276 'where' => 'civicrm_participant.status_id',
277 'headerPattern' => '/(participant.)?(status)$/i',
c3fc2621 278 'export' => TRUE,
e501603b 279 'default' => '1',
522a26c9 280 'table_name' => 'civicrm_participant',
281 'entity' => 'Participant',
282 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 283 'localizable' => 0,
e501603b 284 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
c3fc2621 285 'html' => [
e501603b 286 'type' => 'Select',
c3fc2621
CW
287 ],
288 'pseudoconstant' => [
e501603b
TO
289 'table' => 'civicrm_participant_status_type',
290 'keyColumn' => 'id',
291 'labelColumn' => 'label',
e6ca0a57 292 ],
a9d0587b 293 'add' => '1.7',
c3fc2621
CW
294 ],
295 'participant_role_id' => [
e501603b
TO
296 'name' => 'role_id',
297 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 298 'title' => ts('Participant Role'),
215b423e 299 'description' => ts('Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.'),
e501603b
TO
300 'maxlength' => 128,
301 'size' => CRM_Utils_Type::HUGE,
c3fc2621 302 'import' => TRUE,
e501603b
TO
303 'where' => 'civicrm_participant.role_id',
304 'headerPattern' => '/(participant.)?(role)$/i',
c3fc2621 305 'export' => TRUE,
e501603b 306 'default' => 'NULL',
522a26c9 307 'table_name' => 'civicrm_participant',
308 'entity' => 'Participant',
309 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 310 'localizable' => 0,
2a5c9b4d 311 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
c3fc2621 312 'html' => [
e501603b 313 'type' => 'Select',
c3fc2621
CW
314 ],
315 'pseudoconstant' => [
e501603b
TO
316 'optionGroupName' => 'participant_role',
317 'optionEditPath' => 'civicrm/admin/options/participant_role',
e6ca0a57 318 ],
a9d0587b 319 'add' => '1.7',
c3fc2621
CW
320 ],
321 'participant_register_date' => [
e501603b
TO
322 'name' => 'register_date',
323 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 324 'title' => ts('Register date'),
215b423e 325 'description' => ts('When did contact register for event?'),
c3fc2621 326 'import' => TRUE,
e501603b
TO
327 'where' => 'civicrm_participant.register_date',
328 'headerPattern' => '/^(r(egister\s)?date)$/i',
c3fc2621 329 'export' => TRUE,
522a26c9 330 'table_name' => 'civicrm_participant',
331 'entity' => 'Participant',
332 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 333 'localizable' => 0,
c3fc2621 334 'html' => [
522a26c9 335 'type' => 'Select Date',
24317d89 336 'formatType' => 'activityDateTime',
c3fc2621 337 ],
a9d0587b 338 'add' => '1.7',
c3fc2621
CW
339 ],
340 'participant_source' => [
e501603b
TO
341 'name' => 'source',
342 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 343 'title' => ts('Participant Source'),
215b423e 344 'description' => ts('Source of this event registration.'),
e501603b
TO
345 'maxlength' => 128,
346 'size' => CRM_Utils_Type::HUGE,
c3fc2621 347 'import' => TRUE,
e501603b
TO
348 'where' => 'civicrm_participant.source',
349 'headerPattern' => '/(participant.)?(source)$/i',
c3fc2621 350 'export' => TRUE,
522a26c9 351 'table_name' => 'civicrm_participant',
352 'entity' => 'Participant',
353 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 354 'localizable' => 0,
c1a6d6ac
SL
355 'html' => [
356 'type' => 'Text',
357 ],
a9d0587b 358 'add' => '1.7',
c3fc2621
CW
359 ],
360 'participant_fee_level' => [
e501603b
TO
361 'name' => 'fee_level',
362 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 363 'title' => ts('Fee level'),
215b423e 364 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
fb607354 365 we store the label value and not the key'),
c3fc2621 366 'import' => TRUE,
e501603b
TO
367 'where' => 'civicrm_participant.fee_level',
368 'headerPattern' => '/^(f(ee\s)?level)$/i',
c3fc2621 369 'export' => TRUE,
522a26c9 370 'table_name' => 'civicrm_participant',
371 'entity' => 'Participant',
372 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 373 'localizable' => 0,
2a5c9b4d 374 'serialize' => self::SERIALIZE_SEPARATOR_BOOKEND,
a9d0587b 375 'add' => '1.7',
c3fc2621
CW
376 ],
377 'participant_is_test' => [
e501603b
TO
378 'name' => 'is_test',
379 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621
CW
380 'title' => ts('Test'),
381 'import' => TRUE,
e501603b 382 'where' => 'civicrm_participant.is_test',
c3fc2621 383 'export' => TRUE,
45a83e42 384 'default' => '0',
522a26c9 385 'table_name' => 'civicrm_participant',
386 'entity' => 'Participant',
387 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 388 'localizable' => 0,
a9d0587b 389 'add' => '1.7',
c3fc2621
CW
390 ],
391 'participant_is_pay_later' => [
e501603b
TO
392 'name' => 'is_pay_later',
393 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621
CW
394 'title' => ts('Is Pay Later'),
395 'import' => TRUE,
e501603b
TO
396 'where' => 'civicrm_participant.is_pay_later',
397 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
c3fc2621 398 'export' => TRUE,
45a83e42 399 'default' => '0',
522a26c9 400 'table_name' => 'civicrm_participant',
401 'entity' => 'Participant',
402 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 403 'localizable' => 0,
a9d0587b 404 'add' => '2.1',
c3fc2621
CW
405 ],
406 'participant_fee_amount' => [
e501603b
TO
407 'name' => 'fee_amount',
408 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 409 'title' => ts('Fee Amount'),
215b423e 410 'description' => ts('actual processor fee if known - may be 0.'),
c3fc2621 411 'precision' => [
e501603b 412 20,
fb607354 413 2,
c3fc2621
CW
414 ],
415 'import' => TRUE,
e501603b
TO
416 'where' => 'civicrm_participant.fee_amount',
417 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
418 'dataPattern' => '/^\d+(\.\d{2})?$/',
c3fc2621 419 'export' => TRUE,
522a26c9 420 'table_name' => 'civicrm_participant',
421 'entity' => 'Participant',
422 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 423 'localizable' => 0,
a9d0587b 424 'add' => '2.1',
c3fc2621
CW
425 ],
426 'participant_registered_by_id' => [
e501603b
TO
427 'name' => 'registered_by_id',
428 'type' => CRM_Utils_Type::T_INT,
c3fc2621 429 'title' => ts('Registered By ID'),
215b423e 430 'description' => ts('FK to Participant ID'),
c3fc2621 431 'import' => TRUE,
e501603b 432 'where' => 'civicrm_participant.registered_by_id',
c3fc2621 433 'export' => TRUE,
e501603b 434 'default' => 'NULL',
522a26c9 435 'table_name' => 'civicrm_participant',
436 'entity' => 'Participant',
437 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 438 'localizable' => 0,
e501603b 439 'FKClassName' => 'CRM_Event_DAO_Participant',
a9d0587b 440 'add' => '2.1',
c3fc2621
CW
441 ],
442 'participant_discount_id' => [
e501603b
TO
443 'name' => 'discount_id',
444 'type' => CRM_Utils_Type::T_INT,
c3fc2621 445 'title' => ts('Discount ID'),
215b423e 446 'description' => ts('FK to Discount ID'),
a36434b9 447 'where' => 'civicrm_participant.discount_id',
e501603b 448 'default' => 'NULL',
522a26c9 449 'table_name' => 'civicrm_participant',
450 'entity' => 'Participant',
451 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 452 'localizable' => 0,
e501603b 453 'FKClassName' => 'CRM_Core_DAO_Discount',
a9d0587b 454 'add' => '2.1',
c3fc2621
CW
455 ],
456 'participant_fee_currency' => [
e501603b
TO
457 'name' => 'fee_currency',
458 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 459 'title' => ts('Fee Currency'),
215b423e 460 'description' => ts('3 character string, value derived from config setting.'),
e501603b
TO
461 'maxlength' => 3,
462 'size' => CRM_Utils_Type::FOUR,
c3fc2621 463 'import' => TRUE,
e501603b
TO
464 'where' => 'civicrm_participant.fee_currency',
465 'headerPattern' => '/(fee)?.?cur(rency)?/i',
466 'dataPattern' => '/^[A-Z]{3}$/i',
c3fc2621 467 'export' => TRUE,
e501603b 468 'default' => 'NULL',
522a26c9 469 'table_name' => 'civicrm_participant',
470 'entity' => 'Participant',
471 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 472 'localizable' => 0,
c3fc2621 473 'html' => [
e501603b 474 'type' => 'Select',
c3fc2621
CW
475 ],
476 'pseudoconstant' => [
e501603b
TO
477 'table' => 'civicrm_currency',
478 'keyColumn' => 'name',
479 'labelColumn' => 'full_name',
480 'nameColumn' => 'name',
a8fdb24e 481 'abbrColumn' => 'symbol',
e6ca0a57 482 ],
a9d0587b 483 'add' => '3.0',
c3fc2621
CW
484 ],
485 'participant_campaign_id' => [
e501603b
TO
486 'name' => 'campaign_id',
487 'type' => CRM_Utils_Type::T_INT,
c3fc2621 488 'title' => ts('Campaign'),
215b423e 489 'description' => ts('The campaign for which this participant has been registered.'),
c3fc2621 490 'import' => TRUE,
e501603b 491 'where' => 'civicrm_participant.campaign_id',
c3fc2621 492 'export' => TRUE,
522a26c9 493 'table_name' => 'civicrm_participant',
494 'entity' => 'Participant',
495 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 496 'localizable' => 0,
e501603b 497 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
c3fc2621 498 'pseudoconstant' => [
e501603b
TO
499 'table' => 'civicrm_campaign',
500 'keyColumn' => 'id',
501 'labelColumn' => 'title',
e6ca0a57 502 ],
a9d0587b 503 'add' => '3.4',
c3fc2621
CW
504 ],
505 'discount_amount' => [
e501603b
TO
506 'name' => 'discount_amount',
507 'type' => CRM_Utils_Type::T_INT,
c3fc2621 508 'title' => ts('Discount Amount'),
215b423e 509 'description' => ts('Discount Amount'),
a36434b9 510 'where' => 'civicrm_participant.discount_amount',
522a26c9 511 'table_name' => 'civicrm_participant',
512 'entity' => 'Participant',
513 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 514 'localizable' => 0,
a9d0587b 515 'add' => '4.1',
c3fc2621
CW
516 ],
517 'cart_id' => [
e501603b
TO
518 'name' => 'cart_id',
519 'type' => CRM_Utils_Type::T_INT,
c3fc2621 520 'title' => ts('Event Cart ID'),
215b423e 521 'description' => ts('FK to civicrm_event_carts'),
a36434b9 522 'where' => 'civicrm_participant.cart_id',
522a26c9 523 'table_name' => 'civicrm_participant',
524 'entity' => 'Participant',
525 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 526 'localizable' => 0,
e501603b 527 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
a9d0587b 528 'add' => '4.1',
c3fc2621
CW
529 ],
530 'must_wait' => [
e501603b
TO
531 'name' => 'must_wait',
532 'type' => CRM_Utils_Type::T_INT,
c3fc2621 533 'title' => ts('Must Wait on List'),
215b423e 534 'description' => ts('On Waiting List'),
a36434b9 535 'where' => 'civicrm_participant.must_wait',
522a26c9 536 'table_name' => 'civicrm_participant',
537 'entity' => 'Participant',
538 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 539 'localizable' => 0,
a9d0587b 540 'add' => '4.1',
c3fc2621
CW
541 ],
542 'transferred_to_contact_id' => [
e501603b
TO
543 'name' => 'transferred_to_contact_id',
544 'type' => CRM_Utils_Type::T_INT,
c3fc2621 545 'title' => ts('Transferred to Contact ID'),
215b423e 546 'description' => ts('FK to Contact ID'),
c3fc2621 547 'import' => TRUE,
e501603b
TO
548 'where' => 'civicrm_participant.transferred_to_contact_id',
549 'headerPattern' => '/transfer(.?id)?/i',
c3fc2621 550 'export' => TRUE,
e501603b 551 'default' => 'NULL',
522a26c9 552 'table_name' => 'civicrm_participant',
553 'entity' => 'Participant',
554 'bao' => 'CRM_Event_BAO_Participant',
6a7e5e5d 555 'localizable' => 0,
e501603b 556 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 557 'add' => '4.7',
c3fc2621
CW
558 ],
559 ];
346aaaba 560 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 561 }
346aaaba 562 return Civi::$statics[__CLASS__]['fields'];
e501603b 563 }
c3fc2621 564
e501603b 565 /**
bd8e0b14 566 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
567 *
568 * @return array
bd8e0b14 569 * Array(string $name => string $uniqueName).
e501603b 570 */
c3fc2621 571 public static function &fieldKeys() {
bd8e0b14
TO
572 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
573 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 574 }
bd8e0b14 575 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 576 }
c3fc2621 577
e501603b
TO
578 /**
579 * Returns the names of this table
580 *
581 * @return string
582 */
c3fc2621 583 public static function getTableName() {
e501603b
TO
584 return self::$_tableName;
585 }
c3fc2621 586
e501603b
TO
587 /**
588 * Returns if this table needs to be logged
589 *
c3fc2621 590 * @return bool
e501603b 591 */
c3fc2621 592 public function getLog() {
e501603b
TO
593 return self::$_log;
594 }
c3fc2621 595
e501603b
TO
596 /**
597 * Returns the list of fields that can be imported
598 *
599 * @param bool $prefix
600 *
601 * @return array
602 */
c3fc2621
CW
603 public static function &import($prefix = FALSE) {
604 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant', $prefix, []);
60808919 605 return $r;
e501603b 606 }
c3fc2621 607
e501603b
TO
608 /**
609 * Returns the list of fields that can be exported
610 *
611 * @param bool $prefix
612 *
613 * @return array
614 */
c3fc2621
CW
615 public static function &export($prefix = FALSE) {
616 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant', $prefix, []);
60808919 617 return $r;
e501603b 618 }
c3fc2621 619
e7a6b91a
AS
620 /**
621 * Returns the list of indices
c3fc2621
CW
622 *
623 * @param bool $localize
624 *
625 * @return array
e7a6b91a
AS
626 */
627 public static function indices($localize = TRUE) {
c3fc2621
CW
628 $indices = [
629 'index_status_id' => [
e7a6b91a 630 'name' => 'index_status_id',
c3fc2621 631 'field' => [
e7a6b91a 632 0 => 'status_id',
c3fc2621
CW
633 ],
634 'localizable' => FALSE,
e7a6b91a 635 'sig' => 'civicrm_participant::0::status_id',
c3fc2621
CW
636 ],
637 'index_role_id' => [
e7a6b91a 638 'name' => 'index_role_id',
c3fc2621 639 'field' => [
e7a6b91a 640 0 => 'role_id',
c3fc2621
CW
641 ],
642 'localizable' => FALSE,
e7a6b91a 643 'sig' => 'civicrm_participant::0::role_id',
c3fc2621
CW
644 ],
645 ];
e7a6b91a
AS
646 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
647 }
c3fc2621 648
e501603b 649}