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:4ca199ee96c9079ad7ce673c7a06d5f6)
13 * Database access object for the Participant entity.
15 class CRM_Event_DAO_Participant
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.7';
18 const COMPONENT
= 'CiviEvent';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_participant';
28 * Icon associated with this entity.
32 public static $_icon = 'fa-ticket';
35 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 public static $_log = TRUE;
63 * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.
70 * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
77 * When did contact register for event?
81 public $register_date;
84 * Source of this event registration.
91 * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
92 * we store the label value and not the key
106 public $is_pay_later;
109 * actual processor fee if known - may be 0.
116 * FK to Participant ID
120 public $registered_by_id;
130 * 3 character string, value derived from config setting.
134 public $fee_currency;
137 * The campaign for which this participant has been registered.
148 public $discount_amount;
151 * FK to civicrm_event_carts
169 public $transferred_to_contact_id;
174 public function __construct() {
175 $this->__table
= 'civicrm_participant';
176 parent
::__construct();
180 * Returns localized title of this entity.
182 * @param bool $plural
183 * Whether to return the plural version of the title.
185 public static function getEntityTitle($plural = FALSE) {
186 return $plural ?
ts('Participants') : ts('Participant');
190 * Returns user-friendly description of this entity.
194 public static function getEntityDescription() {
195 return ts('Records of contacts\' attendance and roles in events.');
199 * Returns foreign keys and entity references.
202 * [CRM_Core_Reference_Interface]
204 public static function getReferenceColumns() {
205 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
206 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
215 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
217 return Civi
::$statics[__CLASS__
]['links'];
221 * Returns all the column names of this table
225 public static function &fields() {
226 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
227 Civi
::$statics[__CLASS__
]['fields'] = [
228 'participant_id' => [
230 'type' => CRM_Utils_Type
::T_INT
,
231 'title' => ts('Participant ID'),
232 'description' => ts('Participant ID'),
235 'where' => 'civicrm_participant.id',
236 'headerPattern' => '/(^(participant(.)?)?id$)/i',
238 'table_name' => 'civicrm_participant',
239 'entity' => 'Participant',
240 'bao' => 'CRM_Event_BAO_Participant',
248 'participant_contact_id' => [
249 'name' => 'contact_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Contact ID'),
252 'description' => ts('FK to Contact ID'),
255 'where' => 'civicrm_participant.contact_id',
256 'headerPattern' => '/contact(.?id)?/i',
258 'table_name' => 'civicrm_participant',
259 'entity' => 'Participant',
260 'bao' => 'CRM_Event_BAO_Participant',
262 'FKClassName' => 'CRM_Contact_DAO_Contact',
264 'label' => ts("Contact"),
269 'name' => 'event_id',
270 'type' => CRM_Utils_Type
::T_INT
,
271 'title' => ts('Event ID'),
272 'description' => ts('FK to Event ID'),
275 'where' => 'civicrm_participant.event_id',
276 'headerPattern' => '/event id$/i',
278 'table_name' => 'civicrm_participant',
279 'entity' => 'Participant',
280 'bao' => 'CRM_Event_BAO_Participant',
282 'FKClassName' => 'CRM_Event_DAO_Event',
284 'label' => ts("Event"),
288 'participant_status_id' => [
289 'name' => 'status_id',
290 'type' => CRM_Utils_Type
::T_INT
,
291 'title' => ts('Status ID'),
292 'description' => ts('Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.'),
295 'where' => 'civicrm_participant.status_id',
296 'headerPattern' => '/(participant.)?(status)$/i',
299 'table_name' => 'civicrm_participant',
300 'entity' => 'Participant',
301 'bao' => 'CRM_Event_BAO_Participant',
303 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
306 'label' => ts("Status"),
308 'pseudoconstant' => [
309 'table' => 'civicrm_participant_status_type',
311 'labelColumn' => 'label',
315 'participant_role_id' => [
317 'type' => CRM_Utils_Type
::T_STRING
,
318 'title' => ts('Participant Role ID'),
319 'description' => ts('Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.'),
321 'size' => CRM_Utils_Type
::HUGE
,
323 'where' => 'civicrm_participant.role_id',
324 'headerPattern' => '/(participant.)?(role)$/i',
327 'table_name' => 'civicrm_participant',
328 'entity' => 'Participant',
329 'bao' => 'CRM_Event_BAO_Participant',
331 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
334 'label' => ts("Participant Role"),
336 'pseudoconstant' => [
337 'optionGroupName' => 'participant_role',
338 'optionEditPath' => 'civicrm/admin/options/participant_role',
342 'participant_register_date' => [
343 'name' => 'register_date',
344 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
345 'title' => ts('Register date'),
346 'description' => ts('When did contact register for event?'),
348 'where' => 'civicrm_participant.register_date',
349 'headerPattern' => '/^(r(egister\s)?date)$/i',
351 'table_name' => 'civicrm_participant',
352 'entity' => 'Participant',
353 'bao' => 'CRM_Event_BAO_Participant',
356 'type' => 'Select Date',
357 'formatType' => 'activityDateTime',
361 'participant_source' => [
363 'type' => CRM_Utils_Type
::T_STRING
,
364 'title' => ts('Participant Source'),
365 'description' => ts('Source of this event registration.'),
367 'size' => CRM_Utils_Type
::HUGE
,
369 'where' => 'civicrm_participant.source',
370 'headerPattern' => '/(participant.)?(source)$/i',
372 'table_name' => 'civicrm_participant',
373 'entity' => 'Participant',
374 'bao' => 'CRM_Event_BAO_Participant',
381 'participant_fee_level' => [
382 'name' => 'fee_level',
383 'type' => CRM_Utils_Type
::T_TEXT
,
384 'title' => ts('Fee level'),
385 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
386 we store the label value and not the key'),
388 'where' => 'civicrm_participant.fee_level',
389 'headerPattern' => '/^(f(ee\s)?level)$/i',
391 'table_name' => 'civicrm_participant',
392 'entity' => 'Participant',
393 'bao' => 'CRM_Event_BAO_Participant',
395 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
398 'participant_is_test' => [
400 'type' => CRM_Utils_Type
::T_BOOLEAN
,
401 'title' => ts('Test'),
403 'where' => 'civicrm_participant.is_test',
406 'table_name' => 'civicrm_participant',
407 'entity' => 'Participant',
408 'bao' => 'CRM_Event_BAO_Participant',
412 'participant_is_pay_later' => [
413 'name' => 'is_pay_later',
414 'type' => CRM_Utils_Type
::T_BOOLEAN
,
415 'title' => ts('Is Pay Later'),
417 'where' => 'civicrm_participant.is_pay_later',
418 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
421 'table_name' => 'civicrm_participant',
422 'entity' => 'Participant',
423 'bao' => 'CRM_Event_BAO_Participant',
427 'participant_fee_amount' => [
428 'name' => 'fee_amount',
429 'type' => CRM_Utils_Type
::T_MONEY
,
430 'title' => ts('Fee Amount'),
431 'description' => ts('actual processor fee if known - may be 0.'),
437 'where' => 'civicrm_participant.fee_amount',
438 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
439 'dataPattern' => '/^\d+(\.\d{2})?$/',
441 'table_name' => 'civicrm_participant',
442 'entity' => 'Participant',
443 'bao' => 'CRM_Event_BAO_Participant',
447 'participant_registered_by_id' => [
448 'name' => 'registered_by_id',
449 'type' => CRM_Utils_Type
::T_INT
,
450 'title' => ts('Registered By Participant ID'),
451 'description' => ts('FK to Participant ID'),
453 'where' => 'civicrm_participant.registered_by_id',
456 'table_name' => 'civicrm_participant',
457 'entity' => 'Participant',
458 'bao' => 'CRM_Event_BAO_Participant',
460 'FKClassName' => 'CRM_Event_DAO_Participant',
462 'label' => ts("Registered By"),
466 'participant_discount_id' => [
467 'name' => 'discount_id',
468 'type' => CRM_Utils_Type
::T_INT
,
469 'title' => ts('Discount ID'),
470 'description' => ts('FK to Discount ID'),
471 'where' => 'civicrm_participant.discount_id',
473 'table_name' => 'civicrm_participant',
474 'entity' => 'Participant',
475 'bao' => 'CRM_Event_BAO_Participant',
477 'FKClassName' => 'CRM_Core_DAO_Discount',
479 'label' => ts("Discount"),
483 'participant_fee_currency' => [
484 'name' => 'fee_currency',
485 'type' => CRM_Utils_Type
::T_STRING
,
486 'title' => ts('Fee Currency'),
487 'description' => ts('3 character string, value derived from config setting.'),
489 'size' => CRM_Utils_Type
::FOUR
,
491 'where' => 'civicrm_participant.fee_currency',
492 'headerPattern' => '/(fee)?.?cur(rency)?/i',
493 'dataPattern' => '/^[A-Z]{3}$/i',
496 'table_name' => 'civicrm_participant',
497 'entity' => 'Participant',
498 'bao' => 'CRM_Event_BAO_Participant',
503 'pseudoconstant' => [
504 'table' => 'civicrm_currency',
505 'keyColumn' => 'name',
506 'labelColumn' => 'full_name',
507 'nameColumn' => 'name',
508 'abbrColumn' => 'symbol',
512 'participant_campaign_id' => [
513 'name' => 'campaign_id',
514 'type' => CRM_Utils_Type
::T_INT
,
515 'title' => ts('Campaign ID'),
516 'description' => ts('The campaign for which this participant has been registered.'),
518 'where' => 'civicrm_participant.campaign_id',
520 'table_name' => 'civicrm_participant',
521 'entity' => 'Participant',
522 'bao' => 'CRM_Event_BAO_Participant',
524 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
525 'component' => 'CiviCampaign',
527 'type' => 'EntityRef',
528 'label' => ts("Campaign"),
530 'pseudoconstant' => [
531 'table' => 'civicrm_campaign',
533 'labelColumn' => 'title',
534 'prefetch' => 'FALSE',
538 'discount_amount' => [
539 'name' => 'discount_amount',
540 'type' => CRM_Utils_Type
::T_INT
,
541 'title' => ts('Discount Amount'),
542 'description' => ts('Discount Amount'),
543 'where' => 'civicrm_participant.discount_amount',
544 'table_name' => 'civicrm_participant',
545 'entity' => 'Participant',
546 'bao' => 'CRM_Event_BAO_Participant',
552 'type' => CRM_Utils_Type
::T_INT
,
553 'title' => ts('Event Cart ID'),
554 'description' => ts('FK to civicrm_event_carts'),
555 'where' => 'civicrm_participant.cart_id',
556 'table_name' => 'civicrm_participant',
557 'entity' => 'Participant',
558 'bao' => 'CRM_Event_BAO_Participant',
560 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
562 'label' => ts("Event Cart"),
567 'name' => 'must_wait',
568 'type' => CRM_Utils_Type
::T_INT
,
569 'title' => ts('Must Wait on List'),
570 'description' => ts('On Waiting List'),
571 'where' => 'civicrm_participant.must_wait',
572 'table_name' => 'civicrm_participant',
573 'entity' => 'Participant',
574 'bao' => 'CRM_Event_BAO_Participant',
578 'transferred_to_contact_id' => [
579 'name' => 'transferred_to_contact_id',
580 'type' => CRM_Utils_Type
::T_INT
,
581 'title' => ts('Transferred to Contact ID'),
582 'description' => ts('FK to Contact ID'),
584 'where' => 'civicrm_participant.transferred_to_contact_id',
585 'headerPattern' => '/transfer(.?id)?/i',
588 'table_name' => 'civicrm_participant',
589 'entity' => 'Participant',
590 'bao' => 'CRM_Event_BAO_Participant',
592 'FKClassName' => 'CRM_Contact_DAO_Contact',
594 'label' => ts("Transferred to"),
599 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
601 return Civi
::$statics[__CLASS__
]['fields'];
605 * Return a mapping from field-name to the corresponding key (as used in fields()).
608 * Array(string $name => string $uniqueName).
610 public static function &fieldKeys() {
611 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
612 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
614 return Civi
::$statics[__CLASS__
]['fieldKeys'];
618 * Returns the names of this table
622 public static function getTableName() {
623 return self
::$_tableName;
627 * Returns if this table needs to be logged
631 public function getLog() {
636 * Returns the list of fields that can be imported
638 * @param bool $prefix
642 public static function &import($prefix = FALSE) {
643 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
648 * Returns the list of fields that can be exported
650 * @param bool $prefix
654 public static function &export($prefix = FALSE) {
655 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
660 * Returns the list of indices
662 * @param bool $localize
666 public static function indices($localize = TRUE) {
668 'index_status_id' => [
669 'name' => 'index_status_id',
673 'localizable' => FALSE,
674 'sig' => 'civicrm_participant::0::status_id',
677 'name' => 'index_role_id',
681 'localizable' => FALSE,
682 'sig' => 'civicrm_participant::0::role_id',
685 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;