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:bf8ed42264e81ccaef0ae236242990d0)
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';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_participant';
27 * Icon associated with this entity.
31 public static $_icon = 'fa-ticket';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = TRUE;
62 * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.
69 * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
76 * When did contact register for event?
80 public $register_date;
83 * Source of this event registration.
90 * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
91 * we store the label value and not the key
105 public $is_pay_later;
108 * actual processor fee if known - may be 0.
115 * FK to Participant ID
119 public $registered_by_id;
129 * 3 character string, value derived from config setting.
133 public $fee_currency;
136 * The campaign for which this participant has been registered.
147 public $discount_amount;
150 * FK to civicrm_event_carts
168 public $transferred_to_contact_id;
173 public function __construct() {
174 $this->__table
= 'civicrm_participant';
175 parent
::__construct();
179 * Returns localized title of this entity.
181 public static function getEntityTitle() {
182 return ts('Participants');
186 * Returns foreign keys and entity references.
189 * [CRM_Core_Reference_Interface]
191 public static function getReferenceColumns() {
192 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
193 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
194 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
195 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'event_id', 'civicrm_event', 'id');
196 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'status_id', 'civicrm_participant_status_type', 'id');
197 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'registered_by_id', 'civicrm_participant', 'id');
198 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'discount_id', 'civicrm_discount', 'id');
199 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
200 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'cart_id', 'civicrm_event_carts', 'id');
201 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'transferred_to_contact_id', 'civicrm_contact', 'id');
202 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
204 return Civi
::$statics[__CLASS__
]['links'];
208 * Returns all the column names of this table
212 public static function &fields() {
213 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
214 Civi
::$statics[__CLASS__
]['fields'] = [
215 'participant_id' => [
217 'type' => CRM_Utils_Type
::T_INT
,
218 'title' => ts('Participant ID'),
219 'description' => ts('Participant Id'),
222 'where' => 'civicrm_participant.id',
223 'headerPattern' => '/(^(participant(.)?)?id$)/i',
225 'table_name' => 'civicrm_participant',
226 'entity' => 'Participant',
227 'bao' => 'CRM_Event_BAO_Participant',
231 'participant_contact_id' => [
232 'name' => 'contact_id',
233 'type' => CRM_Utils_Type
::T_INT
,
234 'title' => ts('Contact ID'),
235 'description' => ts('FK to Contact ID'),
238 'where' => 'civicrm_participant.contact_id',
239 'headerPattern' => '/contact(.?id)?/i',
241 'table_name' => 'civicrm_participant',
242 'entity' => 'Participant',
243 'bao' => 'CRM_Event_BAO_Participant',
245 'FKClassName' => 'CRM_Contact_DAO_Contact',
249 'name' => 'event_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Event'),
252 'description' => ts('FK to Event ID'),
255 'where' => 'civicrm_participant.event_id',
256 'headerPattern' => '/event id$/i',
258 'table_name' => 'civicrm_participant',
259 'entity' => 'Participant',
260 'bao' => 'CRM_Event_BAO_Participant',
262 'FKClassName' => 'CRM_Event_DAO_Event',
265 'participant_status_id' => [
266 'name' => 'status_id',
267 'type' => CRM_Utils_Type
::T_INT
,
268 'title' => ts('Participant Status'),
269 'description' => ts('Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.'),
272 'where' => 'civicrm_participant.status_id',
273 'headerPattern' => '/(participant.)?(status)$/i',
276 'table_name' => 'civicrm_participant',
277 'entity' => 'Participant',
278 'bao' => 'CRM_Event_BAO_Participant',
280 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
284 'pseudoconstant' => [
285 'table' => 'civicrm_participant_status_type',
287 'labelColumn' => 'label',
291 'participant_role_id' => [
293 'type' => CRM_Utils_Type
::T_STRING
,
294 'title' => ts('Participant Role'),
295 'description' => ts('Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.'),
297 'size' => CRM_Utils_Type
::HUGE
,
299 'where' => 'civicrm_participant.role_id',
300 'headerPattern' => '/(participant.)?(role)$/i',
303 'table_name' => 'civicrm_participant',
304 'entity' => 'Participant',
305 'bao' => 'CRM_Event_BAO_Participant',
307 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
311 'pseudoconstant' => [
312 'optionGroupName' => 'participant_role',
313 'optionEditPath' => 'civicrm/admin/options/participant_role',
317 'participant_register_date' => [
318 'name' => 'register_date',
319 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
320 'title' => ts('Register date'),
321 'description' => ts('When did contact register for event?'),
323 'where' => 'civicrm_participant.register_date',
324 'headerPattern' => '/^(r(egister\s)?date)$/i',
326 'table_name' => 'civicrm_participant',
327 'entity' => 'Participant',
328 'bao' => 'CRM_Event_BAO_Participant',
331 'type' => 'Select Date',
332 'formatType' => 'activityDateTime',
336 'participant_source' => [
338 'type' => CRM_Utils_Type
::T_STRING
,
339 'title' => ts('Participant Source'),
340 'description' => ts('Source of this event registration.'),
342 'size' => CRM_Utils_Type
::HUGE
,
344 'where' => 'civicrm_participant.source',
345 'headerPattern' => '/(participant.)?(source)$/i',
347 'table_name' => 'civicrm_participant',
348 'entity' => 'Participant',
349 'bao' => 'CRM_Event_BAO_Participant',
356 'participant_fee_level' => [
357 'name' => 'fee_level',
358 'type' => CRM_Utils_Type
::T_TEXT
,
359 'title' => ts('Fee level'),
360 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
361 we store the label value and not the key'),
363 'where' => 'civicrm_participant.fee_level',
364 'headerPattern' => '/^(f(ee\s)?level)$/i',
366 'table_name' => 'civicrm_participant',
367 'entity' => 'Participant',
368 'bao' => 'CRM_Event_BAO_Participant',
370 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
373 'participant_is_test' => [
375 'type' => CRM_Utils_Type
::T_BOOLEAN
,
376 'title' => ts('Test'),
378 'where' => 'civicrm_participant.is_test',
381 'table_name' => 'civicrm_participant',
382 'entity' => 'Participant',
383 'bao' => 'CRM_Event_BAO_Participant',
387 'participant_is_pay_later' => [
388 'name' => 'is_pay_later',
389 'type' => CRM_Utils_Type
::T_BOOLEAN
,
390 'title' => ts('Is Pay Later'),
392 'where' => 'civicrm_participant.is_pay_later',
393 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
396 'table_name' => 'civicrm_participant',
397 'entity' => 'Participant',
398 'bao' => 'CRM_Event_BAO_Participant',
402 'participant_fee_amount' => [
403 'name' => 'fee_amount',
404 'type' => CRM_Utils_Type
::T_MONEY
,
405 'title' => ts('Fee Amount'),
406 'description' => ts('actual processor fee if known - may be 0.'),
412 'where' => 'civicrm_participant.fee_amount',
413 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
414 'dataPattern' => '/^\d+(\.\d{2})?$/',
416 'table_name' => 'civicrm_participant',
417 'entity' => 'Participant',
418 'bao' => 'CRM_Event_BAO_Participant',
422 'participant_registered_by_id' => [
423 'name' => 'registered_by_id',
424 'type' => CRM_Utils_Type
::T_INT
,
425 'title' => ts('Registered By ID'),
426 'description' => ts('FK to Participant ID'),
428 'where' => 'civicrm_participant.registered_by_id',
431 'table_name' => 'civicrm_participant',
432 'entity' => 'Participant',
433 'bao' => 'CRM_Event_BAO_Participant',
435 'FKClassName' => 'CRM_Event_DAO_Participant',
438 'participant_discount_id' => [
439 'name' => 'discount_id',
440 'type' => CRM_Utils_Type
::T_INT
,
441 'title' => ts('Discount ID'),
442 'description' => ts('FK to Discount ID'),
443 'where' => 'civicrm_participant.discount_id',
445 'table_name' => 'civicrm_participant',
446 'entity' => 'Participant',
447 'bao' => 'CRM_Event_BAO_Participant',
449 'FKClassName' => 'CRM_Core_DAO_Discount',
452 'participant_fee_currency' => [
453 'name' => 'fee_currency',
454 'type' => CRM_Utils_Type
::T_STRING
,
455 'title' => ts('Fee Currency'),
456 'description' => ts('3 character string, value derived from config setting.'),
458 'size' => CRM_Utils_Type
::FOUR
,
460 'where' => 'civicrm_participant.fee_currency',
461 'headerPattern' => '/(fee)?.?cur(rency)?/i',
462 'dataPattern' => '/^[A-Z]{3}$/i',
465 'table_name' => 'civicrm_participant',
466 'entity' => 'Participant',
467 'bao' => 'CRM_Event_BAO_Participant',
472 'pseudoconstant' => [
473 'table' => 'civicrm_currency',
474 'keyColumn' => 'name',
475 'labelColumn' => 'full_name',
476 'nameColumn' => 'name',
477 'abbrColumn' => 'symbol',
481 'participant_campaign_id' => [
482 'name' => 'campaign_id',
483 'type' => CRM_Utils_Type
::T_INT
,
484 'title' => ts('Campaign'),
485 'description' => ts('The campaign for which this participant has been registered.'),
487 'where' => 'civicrm_participant.campaign_id',
489 'table_name' => 'civicrm_participant',
490 'entity' => 'Participant',
491 'bao' => 'CRM_Event_BAO_Participant',
493 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
494 'pseudoconstant' => [
495 'table' => 'civicrm_campaign',
497 'labelColumn' => 'title',
501 'discount_amount' => [
502 'name' => 'discount_amount',
503 'type' => CRM_Utils_Type
::T_INT
,
504 'title' => ts('Discount Amount'),
505 'description' => ts('Discount Amount'),
506 'where' => 'civicrm_participant.discount_amount',
507 'table_name' => 'civicrm_participant',
508 'entity' => 'Participant',
509 'bao' => 'CRM_Event_BAO_Participant',
515 'type' => CRM_Utils_Type
::T_INT
,
516 'title' => ts('Event Cart ID'),
517 'description' => ts('FK to civicrm_event_carts'),
518 'where' => 'civicrm_participant.cart_id',
519 'table_name' => 'civicrm_participant',
520 'entity' => 'Participant',
521 'bao' => 'CRM_Event_BAO_Participant',
523 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
527 'name' => 'must_wait',
528 'type' => CRM_Utils_Type
::T_INT
,
529 'title' => ts('Must Wait on List'),
530 'description' => ts('On Waiting List'),
531 'where' => 'civicrm_participant.must_wait',
532 'table_name' => 'civicrm_participant',
533 'entity' => 'Participant',
534 'bao' => 'CRM_Event_BAO_Participant',
538 'transferred_to_contact_id' => [
539 'name' => 'transferred_to_contact_id',
540 'type' => CRM_Utils_Type
::T_INT
,
541 'title' => ts('Transferred to Contact ID'),
542 'description' => ts('FK to Contact ID'),
544 'where' => 'civicrm_participant.transferred_to_contact_id',
545 'headerPattern' => '/transfer(.?id)?/i',
548 'table_name' => 'civicrm_participant',
549 'entity' => 'Participant',
550 'bao' => 'CRM_Event_BAO_Participant',
552 'FKClassName' => 'CRM_Contact_DAO_Contact',
556 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
558 return Civi
::$statics[__CLASS__
]['fields'];
562 * Return a mapping from field-name to the corresponding key (as used in fields()).
565 * Array(string $name => string $uniqueName).
567 public static function &fieldKeys() {
568 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
569 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
571 return Civi
::$statics[__CLASS__
]['fieldKeys'];
575 * Returns the names of this table
579 public static function getTableName() {
580 return self
::$_tableName;
584 * Returns if this table needs to be logged
588 public function getLog() {
593 * Returns the list of fields that can be imported
595 * @param bool $prefix
599 public static function &import($prefix = FALSE) {
600 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
605 * Returns the list of fields that can be exported
607 * @param bool $prefix
611 public static function &export($prefix = FALSE) {
612 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
617 * Returns the list of indices
619 * @param bool $localize
623 public static function indices($localize = TRUE) {
625 'index_status_id' => [
626 'name' => 'index_status_id',
630 'localizable' => FALSE,
631 'sig' => 'civicrm_participant::0::status_id',
634 'name' => 'index_role_id',
638 'localizable' => FALSE,
639 'sig' => 'civicrm_participant::0::role_id',
642 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;