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:b69fa86841b69f5f447c8dbd1b135437)
13 * Database access object for the Participant entity.
15 class CRM_Event_DAO_Participant
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_participant';
25 * Icon associated with this entity.
29 public static $_icon = 'fa-ticket';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = TRUE;
60 * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.
67 * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
74 * When did contact register for event?
78 public $register_date;
81 * Source of this event registration.
88 * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
89 * we store the label value and not the key
103 public $is_pay_later;
106 * actual processor fee if known - may be 0.
113 * FK to Participant ID
117 public $registered_by_id;
127 * 3 character string, value derived from config setting.
131 public $fee_currency;
134 * The campaign for which this participant has been registered.
145 public $discount_amount;
148 * FK to civicrm_event_carts
166 public $transferred_to_contact_id;
171 public function __construct() {
172 $this->__table
= 'civicrm_participant';
173 parent
::__construct();
177 * Returns localized title of this entity.
179 public static function getEntityTitle() {
180 return ts('Participants');
184 * Returns foreign keys and entity references.
187 * [CRM_Core_Reference_Interface]
189 public static function getReferenceColumns() {
190 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
191 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
192 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
193 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'event_id', 'civicrm_event', 'id');
194 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'status_id', 'civicrm_participant_status_type', 'id');
195 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'registered_by_id', 'civicrm_participant', 'id');
196 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'discount_id', 'civicrm_discount', 'id');
197 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
198 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'cart_id', 'civicrm_event_carts', 'id');
199 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'transferred_to_contact_id', 'civicrm_contact', 'id');
200 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
202 return Civi
::$statics[__CLASS__
]['links'];
206 * Returns all the column names of this table
210 public static function &fields() {
211 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
212 Civi
::$statics[__CLASS__
]['fields'] = [
213 'participant_id' => [
215 'type' => CRM_Utils_Type
::T_INT
,
216 'title' => ts('Participant ID'),
217 'description' => ts('Participant Id'),
220 'where' => 'civicrm_participant.id',
221 'headerPattern' => '/(^(participant(.)?)?id$)/i',
223 'table_name' => 'civicrm_participant',
224 'entity' => 'Participant',
225 'bao' => 'CRM_Event_BAO_Participant',
228 'participant_contact_id' => [
229 'name' => 'contact_id',
230 'type' => CRM_Utils_Type
::T_INT
,
231 'title' => ts('Contact ID'),
232 'description' => ts('FK to Contact ID'),
235 'where' => 'civicrm_participant.contact_id',
236 'headerPattern' => '/contact(.?id)?/i',
238 'table_name' => 'civicrm_participant',
239 'entity' => 'Participant',
240 'bao' => 'CRM_Event_BAO_Participant',
242 'FKClassName' => 'CRM_Contact_DAO_Contact',
245 'name' => 'event_id',
246 'type' => CRM_Utils_Type
::T_INT
,
247 'title' => ts('Event'),
248 'description' => ts('FK to Event ID'),
251 'where' => 'civicrm_participant.event_id',
252 'headerPattern' => '/event id$/i',
254 'table_name' => 'civicrm_participant',
255 'entity' => 'Participant',
256 'bao' => 'CRM_Event_BAO_Participant',
258 'FKClassName' => 'CRM_Event_DAO_Event',
260 'participant_status_id' => [
261 'name' => 'status_id',
262 'type' => CRM_Utils_Type
::T_INT
,
263 'title' => ts('Participant Status'),
264 'description' => ts('Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.'),
267 'where' => 'civicrm_participant.status_id',
268 'headerPattern' => '/(participant.)?(status)$/i',
271 'table_name' => 'civicrm_participant',
272 'entity' => 'Participant',
273 'bao' => 'CRM_Event_BAO_Participant',
275 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
279 'pseudoconstant' => [
280 'table' => 'civicrm_participant_status_type',
282 'labelColumn' => 'label',
285 'participant_role_id' => [
287 'type' => CRM_Utils_Type
::T_STRING
,
288 'title' => ts('Participant Role'),
289 'description' => ts('Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.'),
291 'size' => CRM_Utils_Type
::HUGE
,
293 'where' => 'civicrm_participant.role_id',
294 'headerPattern' => '/(participant.)?(role)$/i',
297 'table_name' => 'civicrm_participant',
298 'entity' => 'Participant',
299 'bao' => 'CRM_Event_BAO_Participant',
301 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
305 'pseudoconstant' => [
306 'optionGroupName' => 'participant_role',
307 'optionEditPath' => 'civicrm/admin/options/participant_role',
310 'participant_register_date' => [
311 'name' => 'register_date',
312 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
313 'title' => ts('Register date'),
314 'description' => ts('When did contact register for event?'),
316 'where' => 'civicrm_participant.register_date',
317 'headerPattern' => '/^(r(egister\s)?date)$/i',
319 'table_name' => 'civicrm_participant',
320 'entity' => 'Participant',
321 'bao' => 'CRM_Event_BAO_Participant',
324 'type' => 'Select Date',
325 'formatType' => 'activityDateTime',
328 'participant_source' => [
330 'type' => CRM_Utils_Type
::T_STRING
,
331 'title' => ts('Participant Source'),
332 'description' => ts('Source of this event registration.'),
334 'size' => CRM_Utils_Type
::HUGE
,
336 'where' => 'civicrm_participant.source',
337 'headerPattern' => '/(participant.)?(source)$/i',
339 'table_name' => 'civicrm_participant',
340 'entity' => 'Participant',
341 'bao' => 'CRM_Event_BAO_Participant',
347 'participant_fee_level' => [
348 'name' => 'fee_level',
349 'type' => CRM_Utils_Type
::T_TEXT
,
350 'title' => ts('Fee level'),
351 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
352 we store the label value and not the key'),
354 'where' => 'civicrm_participant.fee_level',
355 'headerPattern' => '/^(f(ee\s)?level)$/i',
357 'table_name' => 'civicrm_participant',
358 'entity' => 'Participant',
359 'bao' => 'CRM_Event_BAO_Participant',
361 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
363 'participant_is_test' => [
365 'type' => CRM_Utils_Type
::T_BOOLEAN
,
366 'title' => ts('Test'),
368 'where' => 'civicrm_participant.is_test',
371 'table_name' => 'civicrm_participant',
372 'entity' => 'Participant',
373 'bao' => 'CRM_Event_BAO_Participant',
376 'participant_is_pay_later' => [
377 'name' => 'is_pay_later',
378 'type' => CRM_Utils_Type
::T_BOOLEAN
,
379 'title' => ts('Is Pay Later'),
381 'where' => 'civicrm_participant.is_pay_later',
382 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
385 'table_name' => 'civicrm_participant',
386 'entity' => 'Participant',
387 'bao' => 'CRM_Event_BAO_Participant',
390 'participant_fee_amount' => [
391 'name' => 'fee_amount',
392 'type' => CRM_Utils_Type
::T_MONEY
,
393 'title' => ts('Fee Amount'),
394 'description' => ts('actual processor fee if known - may be 0.'),
400 'where' => 'civicrm_participant.fee_amount',
401 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
402 'dataPattern' => '/^\d+(\.\d{2})?$/',
404 'table_name' => 'civicrm_participant',
405 'entity' => 'Participant',
406 'bao' => 'CRM_Event_BAO_Participant',
409 'participant_registered_by_id' => [
410 'name' => 'registered_by_id',
411 'type' => CRM_Utils_Type
::T_INT
,
412 'title' => ts('Registered By ID'),
413 'description' => ts('FK to Participant ID'),
415 'where' => 'civicrm_participant.registered_by_id',
418 'table_name' => 'civicrm_participant',
419 'entity' => 'Participant',
420 'bao' => 'CRM_Event_BAO_Participant',
422 'FKClassName' => 'CRM_Event_DAO_Participant',
424 'participant_discount_id' => [
425 'name' => 'discount_id',
426 'type' => CRM_Utils_Type
::T_INT
,
427 'title' => ts('Discount ID'),
428 'description' => ts('FK to Discount ID'),
429 'where' => 'civicrm_participant.discount_id',
431 'table_name' => 'civicrm_participant',
432 'entity' => 'Participant',
433 'bao' => 'CRM_Event_BAO_Participant',
435 'FKClassName' => 'CRM_Core_DAO_Discount',
437 'participant_fee_currency' => [
438 'name' => 'fee_currency',
439 'type' => CRM_Utils_Type
::T_STRING
,
440 'title' => ts('Fee Currency'),
441 'description' => ts('3 character string, value derived from config setting.'),
443 'size' => CRM_Utils_Type
::FOUR
,
445 'where' => 'civicrm_participant.fee_currency',
446 'headerPattern' => '/(fee)?.?cur(rency)?/i',
447 'dataPattern' => '/^[A-Z]{3}$/i',
450 'table_name' => 'civicrm_participant',
451 'entity' => 'Participant',
452 'bao' => 'CRM_Event_BAO_Participant',
457 'pseudoconstant' => [
458 'table' => 'civicrm_currency',
459 'keyColumn' => 'name',
460 'labelColumn' => 'full_name',
461 'nameColumn' => 'name',
462 'abbrColumn' => 'symbol',
465 'participant_campaign_id' => [
466 'name' => 'campaign_id',
467 'type' => CRM_Utils_Type
::T_INT
,
468 'title' => ts('Campaign'),
469 'description' => ts('The campaign for which this participant has been registered.'),
471 'where' => 'civicrm_participant.campaign_id',
473 'table_name' => 'civicrm_participant',
474 'entity' => 'Participant',
475 'bao' => 'CRM_Event_BAO_Participant',
477 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
478 'pseudoconstant' => [
479 'table' => 'civicrm_campaign',
481 'labelColumn' => 'title',
484 'discount_amount' => [
485 'name' => 'discount_amount',
486 'type' => CRM_Utils_Type
::T_INT
,
487 'title' => ts('Discount Amount'),
488 'description' => ts('Discount Amount'),
489 'where' => 'civicrm_participant.discount_amount',
490 'table_name' => 'civicrm_participant',
491 'entity' => 'Participant',
492 'bao' => 'CRM_Event_BAO_Participant',
497 'type' => CRM_Utils_Type
::T_INT
,
498 'title' => ts('Event Cart ID'),
499 'description' => ts('FK to civicrm_event_carts'),
500 'where' => 'civicrm_participant.cart_id',
501 'table_name' => 'civicrm_participant',
502 'entity' => 'Participant',
503 'bao' => 'CRM_Event_BAO_Participant',
505 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
508 'name' => 'must_wait',
509 'type' => CRM_Utils_Type
::T_INT
,
510 'title' => ts('Must Wait on List'),
511 'description' => ts('On Waiting List'),
512 'where' => 'civicrm_participant.must_wait',
513 'table_name' => 'civicrm_participant',
514 'entity' => 'Participant',
515 'bao' => 'CRM_Event_BAO_Participant',
518 'transferred_to_contact_id' => [
519 'name' => 'transferred_to_contact_id',
520 'type' => CRM_Utils_Type
::T_INT
,
521 'title' => ts('Transferred to Contact ID'),
522 'description' => ts('FK to Contact ID'),
524 'where' => 'civicrm_participant.transferred_to_contact_id',
525 'headerPattern' => '/transfer(.?id)?/i',
528 'table_name' => 'civicrm_participant',
529 'entity' => 'Participant',
530 'bao' => 'CRM_Event_BAO_Participant',
532 'FKClassName' => 'CRM_Contact_DAO_Contact',
535 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
537 return Civi
::$statics[__CLASS__
]['fields'];
541 * Return a mapping from field-name to the corresponding key (as used in fields()).
544 * Array(string $name => string $uniqueName).
546 public static function &fieldKeys() {
547 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
548 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
550 return Civi
::$statics[__CLASS__
]['fieldKeys'];
554 * Returns the names of this table
558 public static function getTableName() {
559 return self
::$_tableName;
563 * Returns if this table needs to be logged
567 public function getLog() {
572 * Returns the list of fields that can be imported
574 * @param bool $prefix
578 public static function &import($prefix = FALSE) {
579 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
584 * Returns the list of fields that can be exported
586 * @param bool $prefix
590 public static function &export($prefix = FALSE) {
591 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
596 * Returns the list of indices
598 * @param bool $localize
602 public static function indices($localize = TRUE) {
604 'index_status_id' => [
605 'name' => 'index_status_id',
609 'localizable' => FALSE,
610 'sig' => 'civicrm_participant::0::status_id',
613 'name' => 'index_role_id',
617 'localizable' => FALSE,
618 'sig' => 'civicrm_participant::0::role_id',
621 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;