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:c9cc760db122ae2f826c169efed061f2)
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 foreign keys and entity references.
193 * [CRM_Core_Reference_Interface]
195 public static function getReferenceColumns() {
196 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
197 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
198 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
199 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'event_id', 'civicrm_event', 'id');
200 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'status_id', 'civicrm_participant_status_type', 'id');
201 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'registered_by_id', 'civicrm_participant', 'id');
202 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'discount_id', 'civicrm_discount', 'id');
203 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
204 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'cart_id', 'civicrm_event_carts', 'id');
205 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'transferred_to_contact_id', 'civicrm_contact', 'id');
206 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
208 return Civi
::$statics[__CLASS__
]['links'];
212 * Returns all the column names of this table
216 public static function &fields() {
217 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
218 Civi
::$statics[__CLASS__
]['fields'] = [
219 'participant_id' => [
221 'type' => CRM_Utils_Type
::T_INT
,
222 'title' => ts('Participant ID'),
223 'description' => ts('Participant ID'),
226 'where' => 'civicrm_participant.id',
227 'headerPattern' => '/(^(participant(.)?)?id$)/i',
229 'table_name' => 'civicrm_participant',
230 'entity' => 'Participant',
231 'bao' => 'CRM_Event_BAO_Participant',
239 'participant_contact_id' => [
240 'name' => 'contact_id',
241 'type' => CRM_Utils_Type
::T_INT
,
242 'title' => ts('Contact ID'),
243 'description' => ts('FK to Contact ID'),
246 'where' => 'civicrm_participant.contact_id',
247 'headerPattern' => '/contact(.?id)?/i',
249 'table_name' => 'civicrm_participant',
250 'entity' => 'Participant',
251 'bao' => 'CRM_Event_BAO_Participant',
253 'FKClassName' => 'CRM_Contact_DAO_Contact',
255 'label' => ts("Contact"),
260 'name' => 'event_id',
261 'type' => CRM_Utils_Type
::T_INT
,
262 'title' => ts('Event ID'),
263 'description' => ts('FK to Event ID'),
266 'where' => 'civicrm_participant.event_id',
267 'headerPattern' => '/event id$/i',
269 'table_name' => 'civicrm_participant',
270 'entity' => 'Participant',
271 'bao' => 'CRM_Event_BAO_Participant',
273 'FKClassName' => 'CRM_Event_DAO_Event',
275 'label' => ts("Event"),
279 'participant_status_id' => [
280 'name' => 'status_id',
281 'type' => CRM_Utils_Type
::T_INT
,
282 'title' => ts('Status ID'),
283 'description' => ts('Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.'),
286 'where' => 'civicrm_participant.status_id',
287 'headerPattern' => '/(participant.)?(status)$/i',
290 'table_name' => 'civicrm_participant',
291 'entity' => 'Participant',
292 'bao' => 'CRM_Event_BAO_Participant',
294 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
297 'label' => ts("Status"),
299 'pseudoconstant' => [
300 'table' => 'civicrm_participant_status_type',
302 'labelColumn' => 'label',
306 'participant_role_id' => [
308 'type' => CRM_Utils_Type
::T_STRING
,
309 'title' => ts('Participant Role'),
310 'description' => ts('Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.'),
312 'size' => CRM_Utils_Type
::HUGE
,
314 'where' => 'civicrm_participant.role_id',
315 'headerPattern' => '/(participant.)?(role)$/i',
318 'table_name' => 'civicrm_participant',
319 'entity' => 'Participant',
320 'bao' => 'CRM_Event_BAO_Participant',
322 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
326 'pseudoconstant' => [
327 'optionGroupName' => 'participant_role',
328 'optionEditPath' => 'civicrm/admin/options/participant_role',
332 'participant_register_date' => [
333 'name' => 'register_date',
334 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
335 'title' => ts('Register date'),
336 'description' => ts('When did contact register for event?'),
338 'where' => 'civicrm_participant.register_date',
339 'headerPattern' => '/^(r(egister\s)?date)$/i',
341 'table_name' => 'civicrm_participant',
342 'entity' => 'Participant',
343 'bao' => 'CRM_Event_BAO_Participant',
346 'type' => 'Select Date',
347 'formatType' => 'activityDateTime',
351 'participant_source' => [
353 'type' => CRM_Utils_Type
::T_STRING
,
354 'title' => ts('Participant Source'),
355 'description' => ts('Source of this event registration.'),
357 'size' => CRM_Utils_Type
::HUGE
,
359 'where' => 'civicrm_participant.source',
360 'headerPattern' => '/(participant.)?(source)$/i',
362 'table_name' => 'civicrm_participant',
363 'entity' => 'Participant',
364 'bao' => 'CRM_Event_BAO_Participant',
371 'participant_fee_level' => [
372 'name' => 'fee_level',
373 'type' => CRM_Utils_Type
::T_TEXT
,
374 'title' => ts('Fee level'),
375 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
376 we store the label value and not the key'),
378 'where' => 'civicrm_participant.fee_level',
379 'headerPattern' => '/^(f(ee\s)?level)$/i',
381 'table_name' => 'civicrm_participant',
382 'entity' => 'Participant',
383 'bao' => 'CRM_Event_BAO_Participant',
385 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
388 'participant_is_test' => [
390 'type' => CRM_Utils_Type
::T_BOOLEAN
,
391 'title' => ts('Test'),
393 'where' => 'civicrm_participant.is_test',
396 'table_name' => 'civicrm_participant',
397 'entity' => 'Participant',
398 'bao' => 'CRM_Event_BAO_Participant',
402 'participant_is_pay_later' => [
403 'name' => 'is_pay_later',
404 'type' => CRM_Utils_Type
::T_BOOLEAN
,
405 'title' => ts('Is Pay Later'),
407 'where' => 'civicrm_participant.is_pay_later',
408 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
411 'table_name' => 'civicrm_participant',
412 'entity' => 'Participant',
413 'bao' => 'CRM_Event_BAO_Participant',
417 'participant_fee_amount' => [
418 'name' => 'fee_amount',
419 'type' => CRM_Utils_Type
::T_MONEY
,
420 'title' => ts('Fee Amount'),
421 'description' => ts('actual processor fee if known - may be 0.'),
427 'where' => 'civicrm_participant.fee_amount',
428 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
429 'dataPattern' => '/^\d+(\.\d{2})?$/',
431 'table_name' => 'civicrm_participant',
432 'entity' => 'Participant',
433 'bao' => 'CRM_Event_BAO_Participant',
437 'participant_registered_by_id' => [
438 'name' => 'registered_by_id',
439 'type' => CRM_Utils_Type
::T_INT
,
440 'title' => ts('Registered By Participant ID'),
441 'description' => ts('FK to Participant ID'),
443 'where' => 'civicrm_participant.registered_by_id',
446 'table_name' => 'civicrm_participant',
447 'entity' => 'Participant',
448 'bao' => 'CRM_Event_BAO_Participant',
450 'FKClassName' => 'CRM_Event_DAO_Participant',
452 'label' => ts("Registered By"),
456 'participant_discount_id' => [
457 'name' => 'discount_id',
458 'type' => CRM_Utils_Type
::T_INT
,
459 'title' => ts('Discount ID'),
460 'description' => ts('FK to Discount ID'),
461 'where' => 'civicrm_participant.discount_id',
463 'table_name' => 'civicrm_participant',
464 'entity' => 'Participant',
465 'bao' => 'CRM_Event_BAO_Participant',
467 'FKClassName' => 'CRM_Core_DAO_Discount',
469 'label' => ts("Discount"),
473 'participant_fee_currency' => [
474 'name' => 'fee_currency',
475 'type' => CRM_Utils_Type
::T_STRING
,
476 'title' => ts('Fee Currency'),
477 'description' => ts('3 character string, value derived from config setting.'),
479 'size' => CRM_Utils_Type
::FOUR
,
481 'where' => 'civicrm_participant.fee_currency',
482 'headerPattern' => '/(fee)?.?cur(rency)?/i',
483 'dataPattern' => '/^[A-Z]{3}$/i',
486 'table_name' => 'civicrm_participant',
487 'entity' => 'Participant',
488 'bao' => 'CRM_Event_BAO_Participant',
493 'pseudoconstant' => [
494 'table' => 'civicrm_currency',
495 'keyColumn' => 'name',
496 'labelColumn' => 'full_name',
497 'nameColumn' => 'name',
498 'abbrColumn' => 'symbol',
502 'participant_campaign_id' => [
503 'name' => 'campaign_id',
504 'type' => CRM_Utils_Type
::T_INT
,
505 'title' => ts('Campaign ID'),
506 'description' => ts('The campaign for which this participant has been registered.'),
508 'where' => 'civicrm_participant.campaign_id',
510 'table_name' => 'civicrm_participant',
511 'entity' => 'Participant',
512 'bao' => 'CRM_Event_BAO_Participant',
514 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
516 'label' => ts("Campaign"),
520 'discount_amount' => [
521 'name' => 'discount_amount',
522 'type' => CRM_Utils_Type
::T_INT
,
523 'title' => ts('Discount Amount'),
524 'description' => ts('Discount Amount'),
525 'where' => 'civicrm_participant.discount_amount',
526 'table_name' => 'civicrm_participant',
527 'entity' => 'Participant',
528 'bao' => 'CRM_Event_BAO_Participant',
534 'type' => CRM_Utils_Type
::T_INT
,
535 'title' => ts('Event Cart ID'),
536 'description' => ts('FK to civicrm_event_carts'),
537 'where' => 'civicrm_participant.cart_id',
538 'table_name' => 'civicrm_participant',
539 'entity' => 'Participant',
540 'bao' => 'CRM_Event_BAO_Participant',
542 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
544 'label' => ts("Event Cart"),
549 'name' => 'must_wait',
550 'type' => CRM_Utils_Type
::T_INT
,
551 'title' => ts('Must Wait on List'),
552 'description' => ts('On Waiting List'),
553 'where' => 'civicrm_participant.must_wait',
554 'table_name' => 'civicrm_participant',
555 'entity' => 'Participant',
556 'bao' => 'CRM_Event_BAO_Participant',
560 'transferred_to_contact_id' => [
561 'name' => 'transferred_to_contact_id',
562 'type' => CRM_Utils_Type
::T_INT
,
563 'title' => ts('Transferred to Contact ID'),
564 'description' => ts('FK to Contact ID'),
566 'where' => 'civicrm_participant.transferred_to_contact_id',
567 'headerPattern' => '/transfer(.?id)?/i',
570 'table_name' => 'civicrm_participant',
571 'entity' => 'Participant',
572 'bao' => 'CRM_Event_BAO_Participant',
574 'FKClassName' => 'CRM_Contact_DAO_Contact',
576 'label' => ts("Transferred to"),
581 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
583 return Civi
::$statics[__CLASS__
]['fields'];
587 * Return a mapping from field-name to the corresponding key (as used in fields()).
590 * Array(string $name => string $uniqueName).
592 public static function &fieldKeys() {
593 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
594 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
596 return Civi
::$statics[__CLASS__
]['fieldKeys'];
600 * Returns the names of this table
604 public static function getTableName() {
605 return self
::$_tableName;
609 * Returns if this table needs to be logged
613 public function getLog() {
618 * Returns the list of fields that can be imported
620 * @param bool $prefix
624 public static function &import($prefix = FALSE) {
625 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
630 * Returns the list of fields that can be exported
632 * @param bool $prefix
636 public static function &export($prefix = FALSE) {
637 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
642 * Returns the list of indices
644 * @param bool $localize
648 public static function indices($localize = TRUE) {
650 'index_status_id' => [
651 'name' => 'index_status_id',
655 'localizable' => FALSE,
656 'sig' => 'civicrm_participant::0::status_id',
659 'name' => 'index_role_id',
663 'localizable' => FALSE,
664 'sig' => 'civicrm_participant::0::role_id',
667 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;