5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Event/Participant.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:5ae3aa69ac3d004f649038adbf993b8b)
13 * Database access object for the Participant entity.
15 class CRM_Event_DAO_Participant
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_participant';
25 * Icon associated with this entity.
29 public static $_icon = 'fa-ticket';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = TRUE;
60 * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.
67 * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
74 * When did contact register for event?
78 public $register_date;
81 * Source of this event registration.
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
103 public $is_pay_later;
106 * actual processor fee if known - may be 0.
113 * FK to Participant ID
117 public $registered_by_id;
127 * 3 character string, value derived from config setting.
131 public $fee_currency;
134 * The campaign for which this participant has been registered.
145 public $discount_amount;
148 * FK to civicrm_event_carts
166 public $transferred_to_contact_id;
171 public function __construct() {
172 $this->__table
= 'civicrm_participant';
173 parent
::__construct();
177 * Returns localized title of this entity.
179 public static function getEntityTitle() {
180 return ts('Participants');
184 * Returns foreign keys and entity references.
187 * [CRM_Core_Reference_Interface]
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']);
202 return Civi
::$statics[__CLASS__
]['links'];
206 * Returns all the column names of this table
210 public static function &fields() {
211 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
212 Civi
::$statics[__CLASS__
]['fields'] = [
213 'participant_id' => [
215 'type' => CRM_Utils_Type
::T_INT
,
216 'title' => ts('Participant ID'),
217 'description' => ts('Participant Id'),
220 'where' => 'civicrm_participant.id',
221 'headerPattern' => '/(^(participant(.)?)?id$)/i',
223 'table_name' => 'civicrm_participant',
224 'entity' => 'Participant',
225 'bao' => 'CRM_Event_BAO_Participant',
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'),
236 'where' => 'civicrm_participant.contact_id',
237 'headerPattern' => '/contact(.?id)?/i',
239 'table_name' => 'civicrm_participant',
240 'entity' => 'Participant',
241 'bao' => 'CRM_Event_BAO_Participant',
243 'FKClassName' => 'CRM_Contact_DAO_Contact',
247 'name' => 'event_id',
248 'type' => CRM_Utils_Type
::T_INT
,
249 'title' => ts('Event'),
250 'description' => ts('FK to Event ID'),
253 'where' => 'civicrm_participant.event_id',
254 'headerPattern' => '/event id$/i',
256 'table_name' => 'civicrm_participant',
257 'entity' => 'Participant',
258 'bao' => 'CRM_Event_BAO_Participant',
260 'FKClassName' => 'CRM_Event_DAO_Event',
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.'),
270 'where' => 'civicrm_participant.status_id',
271 'headerPattern' => '/(participant.)?(status)$/i',
274 'table_name' => 'civicrm_participant',
275 'entity' => 'Participant',
276 'bao' => 'CRM_Event_BAO_Participant',
278 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
282 'pseudoconstant' => [
283 'table' => 'civicrm_participant_status_type',
285 'labelColumn' => 'label',
289 'participant_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.'),
295 'size' => CRM_Utils_Type
::HUGE
,
297 'where' => 'civicrm_participant.role_id',
298 'headerPattern' => '/(participant.)?(role)$/i',
301 'table_name' => 'civicrm_participant',
302 'entity' => 'Participant',
303 'bao' => 'CRM_Event_BAO_Participant',
305 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
309 'pseudoconstant' => [
310 'optionGroupName' => 'participant_role',
311 'optionEditPath' => 'civicrm/admin/options/participant_role',
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?'),
321 'where' => 'civicrm_participant.register_date',
322 'headerPattern' => '/^(r(egister\s)?date)$/i',
324 'table_name' => 'civicrm_participant',
325 'entity' => 'Participant',
326 'bao' => 'CRM_Event_BAO_Participant',
329 'type' => 'Select Date',
330 'formatType' => 'activityDateTime',
334 'participant_source' => [
336 'type' => CRM_Utils_Type
::T_STRING
,
337 'title' => ts('Participant Source'),
338 'description' => ts('Source of this event registration.'),
340 'size' => CRM_Utils_Type
::HUGE
,
342 'where' => 'civicrm_participant.source',
343 'headerPattern' => '/(participant.)?(source)$/i',
345 'table_name' => 'civicrm_participant',
346 'entity' => 'Participant',
347 'bao' => 'CRM_Event_BAO_Participant',
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'),
361 'where' => 'civicrm_participant.fee_level',
362 'headerPattern' => '/^(f(ee\s)?level)$/i',
364 'table_name' => 'civicrm_participant',
365 'entity' => 'Participant',
366 'bao' => 'CRM_Event_BAO_Participant',
368 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
371 'participant_is_test' => [
373 'type' => CRM_Utils_Type
::T_BOOLEAN
,
374 'title' => ts('Test'),
376 'where' => 'civicrm_participant.is_test',
379 'table_name' => 'civicrm_participant',
380 'entity' => 'Participant',
381 'bao' => 'CRM_Event_BAO_Participant',
385 'participant_is_pay_later' => [
386 'name' => 'is_pay_later',
387 'type' => CRM_Utils_Type
::T_BOOLEAN
,
388 'title' => ts('Is Pay Later'),
390 'where' => 'civicrm_participant.is_pay_later',
391 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
394 'table_name' => 'civicrm_participant',
395 'entity' => 'Participant',
396 'bao' => 'CRM_Event_BAO_Participant',
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.'),
410 'where' => 'civicrm_participant.fee_amount',
411 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
412 'dataPattern' => '/^\d+(\.\d{2})?$/',
414 'table_name' => 'civicrm_participant',
415 'entity' => 'Participant',
416 'bao' => 'CRM_Event_BAO_Participant',
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'),
426 'where' => 'civicrm_participant.registered_by_id',
429 'table_name' => 'civicrm_participant',
430 'entity' => 'Participant',
431 'bao' => 'CRM_Event_BAO_Participant',
433 'FKClassName' => 'CRM_Event_DAO_Participant',
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',
443 'table_name' => 'civicrm_participant',
444 'entity' => 'Participant',
445 'bao' => 'CRM_Event_BAO_Participant',
447 'FKClassName' => 'CRM_Core_DAO_Discount',
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.'),
456 'size' => CRM_Utils_Type
::FOUR
,
458 'where' => 'civicrm_participant.fee_currency',
459 'headerPattern' => '/(fee)?.?cur(rency)?/i',
460 'dataPattern' => '/^[A-Z]{3}$/i',
463 'table_name' => 'civicrm_participant',
464 'entity' => 'Participant',
465 'bao' => 'CRM_Event_BAO_Participant',
470 'pseudoconstant' => [
471 'table' => 'civicrm_currency',
472 'keyColumn' => 'name',
473 'labelColumn' => 'full_name',
474 'nameColumn' => 'name',
475 'abbrColumn' => 'symbol',
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.'),
485 'where' => 'civicrm_participant.campaign_id',
487 'table_name' => 'civicrm_participant',
488 'entity' => 'Participant',
489 'bao' => 'CRM_Event_BAO_Participant',
491 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
492 'pseudoconstant' => [
493 'table' => 'civicrm_campaign',
495 'labelColumn' => 'title',
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',
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',
521 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
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',
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'),
542 'where' => 'civicrm_participant.transferred_to_contact_id',
543 'headerPattern' => '/transfer(.?id)?/i',
546 'table_name' => 'civicrm_participant',
547 'entity' => 'Participant',
548 'bao' => 'CRM_Event_BAO_Participant',
550 'FKClassName' => 'CRM_Contact_DAO_Contact',
554 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
556 return Civi
::$statics[__CLASS__
]['fields'];
560 * Return a mapping from field-name to the corresponding key (as used in fields()).
563 * Array(string $name => string $uniqueName).
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()));
569 return Civi
::$statics[__CLASS__
]['fieldKeys'];
573 * Returns the names of this table
577 public static function getTableName() {
578 return self
::$_tableName;
582 * Returns if this table needs to be logged
586 public function getLog() {
591 * Returns the list of fields that can be imported
593 * @param bool $prefix
597 public static function &import($prefix = FALSE) {
598 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
603 * Returns the list of fields that can be exported
605 * @param bool $prefix
609 public static function &export($prefix = FALSE) {
610 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
615 * Returns the list of indices
617 * @param bool $localize
621 public static function indices($localize = TRUE) {
623 'index_status_id' => [
624 'name' => 'index_status_id',
628 'localizable' => FALSE,
629 'sig' => 'civicrm_participant::0::status_id',
632 'name' => 'index_role_id',
636 'localizable' => FALSE,
637 'sig' => 'civicrm_participant::0::role_id',
640 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;