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:62382336b5251b2ee93828d70138cd7e)
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;
44 * @var int|string|null
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
63 * (SQL type: int unsigned)
64 * Note that values will be retrieved from the database as a string.
69 * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
78 * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
81 * (SQL type: varchar(128))
82 * Note that values will be retrieved from the database as a string.
87 * When did contact register for event?
90 * (SQL type: datetime)
91 * Note that values will be retrieved from the database as a string.
93 public $register_date;
96 * Source of this event registration.
99 * (SQL type: varchar(128))
100 * Note that values will be retrieved from the database as a string.
105 * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
106 * we store the label value and not the key
110 * Note that values will be retrieved from the database as a string.
115 * @var bool|string|null
116 * (SQL type: tinyint)
117 * Note that values will be retrieved from the database as a string.
122 * @var bool|string|null
123 * (SQL type: tinyint)
124 * Note that values will be retrieved from the database as a string.
126 public $is_pay_later;
129 * actual processor fee if known - may be 0.
131 * @var float|string|null
132 * (SQL type: decimal(20,2))
133 * Note that values will be retrieved from the database as a string.
138 * FK to Participant ID
140 * @var int|string|null
141 * (SQL type: int unsigned)
142 * Note that values will be retrieved from the database as a string.
144 public $registered_by_id;
149 * @var int|string|null
150 * (SQL type: int unsigned)
151 * Note that values will be retrieved from the database as a string.
156 * 3 character string, value derived from config setting.
159 * (SQL type: varchar(3))
160 * Note that values will be retrieved from the database as a string.
162 public $fee_currency;
165 * The campaign for which this participant has been registered.
167 * @var int|string|null
168 * (SQL type: int unsigned)
169 * Note that values will be retrieved from the database as a string.
176 * @var int|string|null
177 * (SQL type: int unsigned)
178 * Note that values will be retrieved from the database as a string.
180 public $discount_amount;
183 * FK to civicrm_event_carts
185 * @var int|string|null
186 * (SQL type: int unsigned)
187 * Note that values will be retrieved from the database as a string.
194 * @var int|string|null
196 * Note that values will be retrieved from the database as a string.
203 * @var int|string|null
204 * (SQL type: int unsigned)
205 * Note that values will be retrieved from the database as a string.
207 public $transferred_to_contact_id;
212 public function __construct() {
213 $this->__table
= 'civicrm_participant';
214 parent
::__construct();
218 * Returns localized title of this entity.
220 * @param bool $plural
221 * Whether to return the plural version of the title.
223 public static function getEntityTitle($plural = FALSE) {
224 return $plural ?
ts('Participants') : ts('Participant');
228 * Returns user-friendly description of this entity.
232 public static function getEntityDescription() {
233 return ts('Records of contacts\' attendance and roles in events.');
237 * Returns foreign keys and entity references.
240 * [CRM_Core_Reference_Interface]
242 public static function getReferenceColumns() {
243 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
244 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
245 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
246 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'event_id', 'civicrm_event', 'id');
247 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'status_id', 'civicrm_participant_status_type', 'id');
248 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'registered_by_id', 'civicrm_participant', 'id');
249 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'discount_id', 'civicrm_discount', 'id');
250 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
251 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'cart_id', 'civicrm_event_carts', 'id');
252 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'transferred_to_contact_id', 'civicrm_contact', 'id');
253 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
255 return Civi
::$statics[__CLASS__
]['links'];
259 * Returns all the column names of this table
263 public static function &fields() {
264 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
265 Civi
::$statics[__CLASS__
]['fields'] = [
266 'participant_id' => [
268 'type' => CRM_Utils_Type
::T_INT
,
269 'title' => ts('Participant ID'),
270 'description' => ts('Participant ID'),
273 'where' => 'civicrm_participant.id',
274 'headerPattern' => '/(^(participant(.)?)?id$)/i',
276 'table_name' => 'civicrm_participant',
277 'entity' => 'Participant',
278 'bao' => 'CRM_Event_BAO_Participant',
286 'participant_contact_id' => [
287 'name' => 'contact_id',
288 'type' => CRM_Utils_Type
::T_INT
,
289 'title' => ts('Contact ID'),
290 'description' => ts('FK to Contact ID'),
293 'where' => 'civicrm_participant.contact_id',
294 'headerPattern' => '/contact(.?id)?/i',
296 'table_name' => 'civicrm_participant',
297 'entity' => 'Participant',
298 'bao' => 'CRM_Event_BAO_Participant',
300 'FKClassName' => 'CRM_Contact_DAO_Contact',
302 'label' => ts("Contact"),
307 'name' => 'event_id',
308 'type' => CRM_Utils_Type
::T_INT
,
309 'title' => ts('Event ID'),
310 'description' => ts('FK to Event ID'),
313 'where' => 'civicrm_participant.event_id',
314 'headerPattern' => '/event id$/i',
316 'table_name' => 'civicrm_participant',
317 'entity' => 'Participant',
318 'bao' => 'CRM_Event_BAO_Participant',
320 'FKClassName' => 'CRM_Event_DAO_Event',
322 'label' => ts("Event"),
326 'participant_status_id' => [
327 'name' => 'status_id',
328 'type' => CRM_Utils_Type
::T_INT
,
329 'title' => ts('Status ID'),
330 'description' => ts('Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.'),
333 'where' => 'civicrm_participant.status_id',
334 'headerPattern' => '/(participant.)?(status)$/i',
337 'table_name' => 'civicrm_participant',
338 'entity' => 'Participant',
339 'bao' => 'CRM_Event_BAO_Participant',
341 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
344 'label' => ts("Status"),
346 'pseudoconstant' => [
347 'table' => 'civicrm_participant_status_type',
349 'labelColumn' => 'label',
353 'participant_role_id' => [
355 'type' => CRM_Utils_Type
::T_STRING
,
356 'title' => ts('Participant Role ID'),
357 'description' => ts('Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.'),
359 'size' => CRM_Utils_Type
::HUGE
,
361 'where' => 'civicrm_participant.role_id',
362 'headerPattern' => '/(participant.)?(role)$/i',
365 'table_name' => 'civicrm_participant',
366 'entity' => 'Participant',
367 'bao' => 'CRM_Event_BAO_Participant',
369 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
372 'label' => ts("Participant Role"),
374 'pseudoconstant' => [
375 'optionGroupName' => 'participant_role',
376 'optionEditPath' => 'civicrm/admin/options/participant_role',
380 'participant_register_date' => [
381 'name' => 'register_date',
382 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
383 'title' => ts('Register date'),
384 'description' => ts('When did contact register for event?'),
386 'where' => 'civicrm_participant.register_date',
387 'headerPattern' => '/^(r(egister\s)?date)$/i',
389 'table_name' => 'civicrm_participant',
390 'entity' => 'Participant',
391 'bao' => 'CRM_Event_BAO_Participant',
394 'type' => 'Select Date',
395 'formatType' => 'activityDateTime',
399 'participant_source' => [
401 'type' => CRM_Utils_Type
::T_STRING
,
402 'title' => ts('Participant Source'),
403 'description' => ts('Source of this event registration.'),
405 'size' => CRM_Utils_Type
::HUGE
,
407 'where' => 'civicrm_participant.source',
408 'headerPattern' => '/(participant.)?(source)$/i',
410 'table_name' => 'civicrm_participant',
411 'entity' => 'Participant',
412 'bao' => 'CRM_Event_BAO_Participant',
419 'participant_fee_level' => [
420 'name' => 'fee_level',
421 'type' => CRM_Utils_Type
::T_TEXT
,
422 'title' => ts('Fee level'),
423 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
424 we store the label value and not the key'),
426 'where' => 'civicrm_participant.fee_level',
427 'headerPattern' => '/^(f(ee\s)?level)$/i',
429 'table_name' => 'civicrm_participant',
430 'entity' => 'Participant',
431 'bao' => 'CRM_Event_BAO_Participant',
433 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
436 'participant_is_test' => [
438 'type' => CRM_Utils_Type
::T_BOOLEAN
,
439 'title' => ts('Test'),
441 'where' => 'civicrm_participant.is_test',
444 'table_name' => 'civicrm_participant',
445 'entity' => 'Participant',
446 'bao' => 'CRM_Event_BAO_Participant',
450 'participant_is_pay_later' => [
451 'name' => 'is_pay_later',
452 'type' => CRM_Utils_Type
::T_BOOLEAN
,
453 'title' => ts('Is Pay Later'),
455 'where' => 'civicrm_participant.is_pay_later',
456 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
459 'table_name' => 'civicrm_participant',
460 'entity' => 'Participant',
461 'bao' => 'CRM_Event_BAO_Participant',
465 'participant_fee_amount' => [
466 'name' => 'fee_amount',
467 'type' => CRM_Utils_Type
::T_MONEY
,
468 'title' => ts('Fee Amount'),
469 'description' => ts('actual processor fee if known - may be 0.'),
475 'where' => 'civicrm_participant.fee_amount',
476 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
477 'dataPattern' => '/^\d+(\.\d{2})?$/',
479 'table_name' => 'civicrm_participant',
480 'entity' => 'Participant',
481 'bao' => 'CRM_Event_BAO_Participant',
485 'participant_registered_by_id' => [
486 'name' => 'registered_by_id',
487 'type' => CRM_Utils_Type
::T_INT
,
488 'title' => ts('Registered By Participant ID'),
489 'description' => ts('FK to Participant ID'),
491 'where' => 'civicrm_participant.registered_by_id',
494 'table_name' => 'civicrm_participant',
495 'entity' => 'Participant',
496 'bao' => 'CRM_Event_BAO_Participant',
498 'FKClassName' => 'CRM_Event_DAO_Participant',
500 'label' => ts("Registered By"),
504 'participant_discount_id' => [
505 'name' => 'discount_id',
506 'type' => CRM_Utils_Type
::T_INT
,
507 'title' => ts('Discount ID'),
508 'description' => ts('FK to Discount ID'),
509 'where' => 'civicrm_participant.discount_id',
511 'table_name' => 'civicrm_participant',
512 'entity' => 'Participant',
513 'bao' => 'CRM_Event_BAO_Participant',
515 'FKClassName' => 'CRM_Core_DAO_Discount',
517 'label' => ts("Discount"),
521 'participant_fee_currency' => [
522 'name' => 'fee_currency',
523 'type' => CRM_Utils_Type
::T_STRING
,
524 'title' => ts('Fee Currency'),
525 'description' => ts('3 character string, value derived from config setting.'),
527 'size' => CRM_Utils_Type
::FOUR
,
529 'where' => 'civicrm_participant.fee_currency',
530 'headerPattern' => '/(fee)?.?cur(rency)?/i',
531 'dataPattern' => '/^[A-Z]{3}$/i',
534 'table_name' => 'civicrm_participant',
535 'entity' => 'Participant',
536 'bao' => 'CRM_Event_BAO_Participant',
541 'pseudoconstant' => [
542 'table' => 'civicrm_currency',
543 'keyColumn' => 'name',
544 'labelColumn' => 'full_name',
545 'nameColumn' => 'name',
546 'abbrColumn' => 'symbol',
550 'participant_campaign_id' => [
551 'name' => 'campaign_id',
552 'type' => CRM_Utils_Type
::T_INT
,
553 'title' => ts('Campaign ID'),
554 'description' => ts('The campaign for which this participant has been registered.'),
556 'where' => 'civicrm_participant.campaign_id',
558 'table_name' => 'civicrm_participant',
559 'entity' => 'Participant',
560 'bao' => 'CRM_Event_BAO_Participant',
562 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
563 'component' => 'CiviCampaign',
565 'type' => 'EntityRef',
566 'label' => ts("Campaign"),
568 'pseudoconstant' => [
569 'table' => 'civicrm_campaign',
571 'labelColumn' => 'title',
572 'prefetch' => 'FALSE',
576 'discount_amount' => [
577 'name' => 'discount_amount',
578 'type' => CRM_Utils_Type
::T_INT
,
579 'title' => ts('Discount Amount'),
580 'description' => ts('Discount Amount'),
581 'where' => 'civicrm_participant.discount_amount',
582 'table_name' => 'civicrm_participant',
583 'entity' => 'Participant',
584 'bao' => 'CRM_Event_BAO_Participant',
590 'type' => CRM_Utils_Type
::T_INT
,
591 'title' => ts('Event Cart ID'),
592 'description' => ts('FK to civicrm_event_carts'),
593 'where' => 'civicrm_participant.cart_id',
594 'table_name' => 'civicrm_participant',
595 'entity' => 'Participant',
596 'bao' => 'CRM_Event_BAO_Participant',
598 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
600 'label' => ts("Event Cart"),
605 'name' => 'must_wait',
606 'type' => CRM_Utils_Type
::T_INT
,
607 'title' => ts('Must Wait on List'),
608 'description' => ts('On Waiting List'),
609 'where' => 'civicrm_participant.must_wait',
610 'table_name' => 'civicrm_participant',
611 'entity' => 'Participant',
612 'bao' => 'CRM_Event_BAO_Participant',
616 'transferred_to_contact_id' => [
617 'name' => 'transferred_to_contact_id',
618 'type' => CRM_Utils_Type
::T_INT
,
619 'title' => ts('Transferred to Contact ID'),
620 'description' => ts('FK to Contact ID'),
622 'where' => 'civicrm_participant.transferred_to_contact_id',
623 'headerPattern' => '/transfer(.?id)?/i',
626 'table_name' => 'civicrm_participant',
627 'entity' => 'Participant',
628 'bao' => 'CRM_Event_BAO_Participant',
630 'FKClassName' => 'CRM_Contact_DAO_Contact',
632 'label' => ts("Transferred to"),
637 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
639 return Civi
::$statics[__CLASS__
]['fields'];
643 * Return a mapping from field-name to the corresponding key (as used in fields()).
646 * Array(string $name => string $uniqueName).
648 public static function &fieldKeys() {
649 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
650 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
652 return Civi
::$statics[__CLASS__
]['fieldKeys'];
656 * Returns the names of this table
660 public static function getTableName() {
661 return self
::$_tableName;
665 * Returns if this table needs to be logged
669 public function getLog() {
674 * Returns the list of fields that can be imported
676 * @param bool $prefix
680 public static function &import($prefix = FALSE) {
681 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
686 * Returns the list of fields that can be exported
688 * @param bool $prefix
692 public static function &export($prefix = FALSE) {
693 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
698 * Returns the list of indices
700 * @param bool $localize
704 public static function indices($localize = TRUE) {
706 'index_status_id' => [
707 'name' => 'index_status_id',
711 'localizable' => FALSE,
712 'sig' => 'civicrm_participant::0::status_id',
715 'name' => 'index_role_id',
719 'localizable' => FALSE,
720 'sig' => 'civicrm_participant::0::role_id',
723 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;