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:fcaf9990a79e1ea3bd799a6ff75db893)
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'),
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
,
335 'pseudoconstant' => [
336 'optionGroupName' => 'participant_role',
337 'optionEditPath' => 'civicrm/admin/options/participant_role',
341 'participant_register_date' => [
342 'name' => 'register_date',
343 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
344 'title' => ts('Register date'),
345 'description' => ts('When did contact register for event?'),
347 'where' => 'civicrm_participant.register_date',
348 'headerPattern' => '/^(r(egister\s)?date)$/i',
350 'table_name' => 'civicrm_participant',
351 'entity' => 'Participant',
352 'bao' => 'CRM_Event_BAO_Participant',
355 'type' => 'Select Date',
356 'formatType' => 'activityDateTime',
360 'participant_source' => [
362 'type' => CRM_Utils_Type
::T_STRING
,
363 'title' => ts('Participant Source'),
364 'description' => ts('Source of this event registration.'),
366 'size' => CRM_Utils_Type
::HUGE
,
368 'where' => 'civicrm_participant.source',
369 'headerPattern' => '/(participant.)?(source)$/i',
371 'table_name' => 'civicrm_participant',
372 'entity' => 'Participant',
373 'bao' => 'CRM_Event_BAO_Participant',
380 'participant_fee_level' => [
381 'name' => 'fee_level',
382 'type' => CRM_Utils_Type
::T_TEXT
,
383 'title' => ts('Fee level'),
384 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
385 we store the label value and not the key'),
387 'where' => 'civicrm_participant.fee_level',
388 'headerPattern' => '/^(f(ee\s)?level)$/i',
390 'table_name' => 'civicrm_participant',
391 'entity' => 'Participant',
392 'bao' => 'CRM_Event_BAO_Participant',
394 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
397 'participant_is_test' => [
399 'type' => CRM_Utils_Type
::T_BOOLEAN
,
400 'title' => ts('Test'),
402 'where' => 'civicrm_participant.is_test',
405 'table_name' => 'civicrm_participant',
406 'entity' => 'Participant',
407 'bao' => 'CRM_Event_BAO_Participant',
411 'participant_is_pay_later' => [
412 'name' => 'is_pay_later',
413 'type' => CRM_Utils_Type
::T_BOOLEAN
,
414 'title' => ts('Is Pay Later'),
416 'where' => 'civicrm_participant.is_pay_later',
417 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
420 'table_name' => 'civicrm_participant',
421 'entity' => 'Participant',
422 'bao' => 'CRM_Event_BAO_Participant',
426 'participant_fee_amount' => [
427 'name' => 'fee_amount',
428 'type' => CRM_Utils_Type
::T_MONEY
,
429 'title' => ts('Fee Amount'),
430 'description' => ts('actual processor fee if known - may be 0.'),
436 'where' => 'civicrm_participant.fee_amount',
437 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
438 'dataPattern' => '/^\d+(\.\d{2})?$/',
440 'table_name' => 'civicrm_participant',
441 'entity' => 'Participant',
442 'bao' => 'CRM_Event_BAO_Participant',
446 'participant_registered_by_id' => [
447 'name' => 'registered_by_id',
448 'type' => CRM_Utils_Type
::T_INT
,
449 'title' => ts('Registered By Participant ID'),
450 'description' => ts('FK to Participant ID'),
452 'where' => 'civicrm_participant.registered_by_id',
455 'table_name' => 'civicrm_participant',
456 'entity' => 'Participant',
457 'bao' => 'CRM_Event_BAO_Participant',
459 'FKClassName' => 'CRM_Event_DAO_Participant',
461 'label' => ts("Registered By"),
465 'participant_discount_id' => [
466 'name' => 'discount_id',
467 'type' => CRM_Utils_Type
::T_INT
,
468 'title' => ts('Discount ID'),
469 'description' => ts('FK to Discount ID'),
470 'where' => 'civicrm_participant.discount_id',
472 'table_name' => 'civicrm_participant',
473 'entity' => 'Participant',
474 'bao' => 'CRM_Event_BAO_Participant',
476 'FKClassName' => 'CRM_Core_DAO_Discount',
478 'label' => ts("Discount"),
482 'participant_fee_currency' => [
483 'name' => 'fee_currency',
484 'type' => CRM_Utils_Type
::T_STRING
,
485 'title' => ts('Fee Currency'),
486 'description' => ts('3 character string, value derived from config setting.'),
488 'size' => CRM_Utils_Type
::FOUR
,
490 'where' => 'civicrm_participant.fee_currency',
491 'headerPattern' => '/(fee)?.?cur(rency)?/i',
492 'dataPattern' => '/^[A-Z]{3}$/i',
495 'table_name' => 'civicrm_participant',
496 'entity' => 'Participant',
497 'bao' => 'CRM_Event_BAO_Participant',
502 'pseudoconstant' => [
503 'table' => 'civicrm_currency',
504 'keyColumn' => 'name',
505 'labelColumn' => 'full_name',
506 'nameColumn' => 'name',
507 'abbrColumn' => 'symbol',
511 'participant_campaign_id' => [
512 'name' => 'campaign_id',
513 'type' => CRM_Utils_Type
::T_INT
,
514 'title' => ts('Campaign ID'),
515 'description' => ts('The campaign for which this participant has been registered.'),
517 'where' => 'civicrm_participant.campaign_id',
519 'table_name' => 'civicrm_participant',
520 'entity' => 'Participant',
521 'bao' => 'CRM_Event_BAO_Participant',
523 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
524 'component' => 'CiviCampaign',
526 'type' => 'EntityRef',
527 'label' => ts("Campaign"),
529 'pseudoconstant' => [
530 'table' => 'civicrm_campaign',
532 'labelColumn' => 'title',
533 'prefetch' => 'FALSE',
537 'discount_amount' => [
538 'name' => 'discount_amount',
539 'type' => CRM_Utils_Type
::T_INT
,
540 'title' => ts('Discount Amount'),
541 'description' => ts('Discount Amount'),
542 'where' => 'civicrm_participant.discount_amount',
543 'table_name' => 'civicrm_participant',
544 'entity' => 'Participant',
545 'bao' => 'CRM_Event_BAO_Participant',
551 'type' => CRM_Utils_Type
::T_INT
,
552 'title' => ts('Event Cart ID'),
553 'description' => ts('FK to civicrm_event_carts'),
554 'where' => 'civicrm_participant.cart_id',
555 'table_name' => 'civicrm_participant',
556 'entity' => 'Participant',
557 'bao' => 'CRM_Event_BAO_Participant',
559 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
561 'label' => ts("Event Cart"),
566 'name' => 'must_wait',
567 'type' => CRM_Utils_Type
::T_INT
,
568 'title' => ts('Must Wait on List'),
569 'description' => ts('On Waiting List'),
570 'where' => 'civicrm_participant.must_wait',
571 'table_name' => 'civicrm_participant',
572 'entity' => 'Participant',
573 'bao' => 'CRM_Event_BAO_Participant',
577 'transferred_to_contact_id' => [
578 'name' => 'transferred_to_contact_id',
579 'type' => CRM_Utils_Type
::T_INT
,
580 'title' => ts('Transferred to Contact ID'),
581 'description' => ts('FK to Contact ID'),
583 'where' => 'civicrm_participant.transferred_to_contact_id',
584 'headerPattern' => '/transfer(.?id)?/i',
587 'table_name' => 'civicrm_participant',
588 'entity' => 'Participant',
589 'bao' => 'CRM_Event_BAO_Participant',
591 'FKClassName' => 'CRM_Contact_DAO_Contact',
593 'label' => ts("Transferred to"),
598 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
600 return Civi
::$statics[__CLASS__
]['fields'];
604 * Return a mapping from field-name to the corresponding key (as used in fields()).
607 * Array(string $name => string $uniqueName).
609 public static function &fieldKeys() {
610 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
611 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
613 return Civi
::$statics[__CLASS__
]['fieldKeys'];
617 * Returns the names of this table
621 public static function getTableName() {
622 return self
::$_tableName;
626 * Returns if this table needs to be logged
630 public function getLog() {
635 * Returns the list of fields that can be imported
637 * @param bool $prefix
641 public static function &import($prefix = FALSE) {
642 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
647 * Returns the list of fields that can be exported
649 * @param bool $prefix
653 public static function &export($prefix = FALSE) {
654 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
659 * Returns the list of indices
661 * @param bool $localize
665 public static function indices($localize = TRUE) {
667 'index_status_id' => [
668 'name' => 'index_status_id',
672 'localizable' => FALSE,
673 'sig' => 'civicrm_participant::0::status_id',
676 'name' => 'index_role_id',
680 'localizable' => FALSE,
681 'sig' => 'civicrm_participant::0::role_id',
684 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;