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:9d1b4abcd8bb1106b31c610026aed0d5)
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.
116 * (SQL type: tinyint)
117 * Note that values will be retrieved from the database as a string.
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'),
442 'where' => 'civicrm_participant.is_test',
445 'table_name' => 'civicrm_participant',
446 'entity' => 'Participant',
447 'bao' => 'CRM_Event_BAO_Participant',
451 'participant_is_pay_later' => [
452 'name' => 'is_pay_later',
453 'type' => CRM_Utils_Type
::T_BOOLEAN
,
454 'title' => ts('Is Pay Later'),
457 'where' => 'civicrm_participant.is_pay_later',
458 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
461 'table_name' => 'civicrm_participant',
462 'entity' => 'Participant',
463 'bao' => 'CRM_Event_BAO_Participant',
467 'participant_fee_amount' => [
468 'name' => 'fee_amount',
469 'type' => CRM_Utils_Type
::T_MONEY
,
470 'title' => ts('Fee Amount'),
471 'description' => ts('actual processor fee if known - may be 0.'),
477 'where' => 'civicrm_participant.fee_amount',
478 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
479 'dataPattern' => '/^\d+(\.\d{2})?$/',
481 'table_name' => 'civicrm_participant',
482 'entity' => 'Participant',
483 'bao' => 'CRM_Event_BAO_Participant',
487 'participant_registered_by_id' => [
488 'name' => 'registered_by_id',
489 'type' => CRM_Utils_Type
::T_INT
,
490 'title' => ts('Registered By Participant ID'),
491 'description' => ts('FK to Participant ID'),
493 'where' => 'civicrm_participant.registered_by_id',
496 'table_name' => 'civicrm_participant',
497 'entity' => 'Participant',
498 'bao' => 'CRM_Event_BAO_Participant',
500 'FKClassName' => 'CRM_Event_DAO_Participant',
502 'label' => ts("Registered By"),
506 'participant_discount_id' => [
507 'name' => 'discount_id',
508 'type' => CRM_Utils_Type
::T_INT
,
509 'title' => ts('Discount ID'),
510 'description' => ts('FK to Discount ID'),
511 'where' => 'civicrm_participant.discount_id',
513 'table_name' => 'civicrm_participant',
514 'entity' => 'Participant',
515 'bao' => 'CRM_Event_BAO_Participant',
517 'FKClassName' => 'CRM_Core_DAO_Discount',
519 'label' => ts("Discount"),
523 'participant_fee_currency' => [
524 'name' => 'fee_currency',
525 'type' => CRM_Utils_Type
::T_STRING
,
526 'title' => ts('Fee Currency'),
527 'description' => ts('3 character string, value derived from config setting.'),
529 'size' => CRM_Utils_Type
::FOUR
,
531 'where' => 'civicrm_participant.fee_currency',
532 'headerPattern' => '/(fee)?.?cur(rency)?/i',
533 'dataPattern' => '/^[A-Z]{3}$/i',
536 'table_name' => 'civicrm_participant',
537 'entity' => 'Participant',
538 'bao' => 'CRM_Event_BAO_Participant',
543 'pseudoconstant' => [
544 'table' => 'civicrm_currency',
545 'keyColumn' => 'name',
546 'labelColumn' => 'full_name',
547 'nameColumn' => 'name',
548 'abbrColumn' => 'symbol',
552 'participant_campaign_id' => [
553 'name' => 'campaign_id',
554 'type' => CRM_Utils_Type
::T_INT
,
555 'title' => ts('Campaign ID'),
556 'description' => ts('The campaign for which this participant has been registered.'),
558 'where' => 'civicrm_participant.campaign_id',
560 'table_name' => 'civicrm_participant',
561 'entity' => 'Participant',
562 'bao' => 'CRM_Event_BAO_Participant',
564 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
565 'component' => 'CiviCampaign',
567 'type' => 'EntityRef',
568 'label' => ts("Campaign"),
570 'pseudoconstant' => [
571 'table' => 'civicrm_campaign',
573 'labelColumn' => 'title',
574 'prefetch' => 'FALSE',
578 'discount_amount' => [
579 'name' => 'discount_amount',
580 'type' => CRM_Utils_Type
::T_INT
,
581 'title' => ts('Discount Amount'),
582 'description' => ts('Discount Amount'),
583 'where' => 'civicrm_participant.discount_amount',
584 'table_name' => 'civicrm_participant',
585 'entity' => 'Participant',
586 'bao' => 'CRM_Event_BAO_Participant',
592 'type' => CRM_Utils_Type
::T_INT
,
593 'title' => ts('Event Cart ID'),
594 'description' => ts('FK to civicrm_event_carts'),
595 'where' => 'civicrm_participant.cart_id',
596 'table_name' => 'civicrm_participant',
597 'entity' => 'Participant',
598 'bao' => 'CRM_Event_BAO_Participant',
600 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
602 'label' => ts("Event Cart"),
607 'name' => 'must_wait',
608 'type' => CRM_Utils_Type
::T_INT
,
609 'title' => ts('Must Wait on List'),
610 'description' => ts('On Waiting List'),
611 'where' => 'civicrm_participant.must_wait',
612 'table_name' => 'civicrm_participant',
613 'entity' => 'Participant',
614 'bao' => 'CRM_Event_BAO_Participant',
618 'transferred_to_contact_id' => [
619 'name' => 'transferred_to_contact_id',
620 'type' => CRM_Utils_Type
::T_INT
,
621 'title' => ts('Transferred to Contact ID'),
622 'description' => ts('FK to Contact ID'),
624 'where' => 'civicrm_participant.transferred_to_contact_id',
625 'headerPattern' => '/transfer(.?id)?/i',
628 'table_name' => 'civicrm_participant',
629 'entity' => 'Participant',
630 'bao' => 'CRM_Event_BAO_Participant',
632 'FKClassName' => 'CRM_Contact_DAO_Contact',
634 'label' => ts("Transferred to"),
639 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
641 return Civi
::$statics[__CLASS__
]['fields'];
645 * Return a mapping from field-name to the corresponding key (as used in fields()).
648 * Array(string $name => string $uniqueName).
650 public static function &fieldKeys() {
651 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
652 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
654 return Civi
::$statics[__CLASS__
]['fieldKeys'];
658 * Returns the names of this table
662 public static function getTableName() {
663 return self
::$_tableName;
667 * Returns if this table needs to be logged
671 public function getLog() {
676 * Returns the list of fields that can be imported
678 * @param bool $prefix
682 public static function &import($prefix = FALSE) {
683 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
688 * Returns the list of fields that can be exported
690 * @param bool $prefix
694 public static function &export($prefix = FALSE) {
695 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
700 * Returns the list of indices
702 * @param bool $localize
706 public static function indices($localize = TRUE) {
708 'index_status_id' => [
709 'name' => 'index_status_id',
713 'localizable' => FALSE,
714 'sig' => 'civicrm_participant::0::status_id',
717 'name' => 'index_role_id',
721 'localizable' => FALSE,
722 'sig' => 'civicrm_participant::0::role_id',
725 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;