5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Event/Participant.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:444d0ee69773ce242341f8544e192087)
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 static $_tableName = 'civicrm_participant';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
53 * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.
60 * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.
67 * When did contact register for event?
71 public $register_date;
74 * Source of this event registration.
81 * Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
82 we store the label value and not the key
99 * actual processor fee if known - may be 0.
106 * FK to Participant ID
110 public $registered_by_id;
120 * 3 character string, value derived from config setting.
124 public $fee_currency;
127 * The campaign for which this participant has been registered.
138 public $discount_amount;
141 * FK to civicrm_event_carts
159 public $transferred_to_contact_id;
164 public function __construct() {
165 $this->__table
= 'civicrm_participant';
166 parent
::__construct();
170 * Returns foreign keys and entity references.
173 * [CRM_Core_Reference_Interface]
175 public static function getReferenceColumns() {
176 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
177 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
178 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
179 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'event_id', 'civicrm_event', 'id');
180 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'status_id', 'civicrm_participant_status_type', 'id');
181 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'registered_by_id', 'civicrm_participant', 'id');
182 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'discount_id', 'civicrm_discount', 'id');
183 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
184 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'cart_id', 'civicrm_event_carts', 'id');
185 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'transferred_to_contact_id', 'civicrm_contact', 'id');
186 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
188 return Civi
::$statics[__CLASS__
]['links'];
192 * Returns all the column names of this table
196 public static function &fields() {
197 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
198 Civi
::$statics[__CLASS__
]['fields'] = [
199 'participant_id' => [
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Participant ID'),
203 'description' => 'Participant Id',
206 'where' => 'civicrm_participant.id',
207 'headerPattern' => '/(^(participant(.)?)?id$)/i',
210 'table_name' => 'civicrm_participant',
211 'entity' => 'Participant',
212 'bao' => 'CRM_Event_BAO_Participant',
215 'participant_contact_id' => [
216 'name' => 'contact_id',
217 'type' => CRM_Utils_Type
::T_INT
,
218 'title' => ts('Contact ID'),
219 'description' => 'FK to Contact ID',
222 'where' => 'civicrm_participant.contact_id',
223 'headerPattern' => '/contact(.?id)?/i',
226 'table_name' => 'civicrm_participant',
227 'entity' => 'Participant',
228 'bao' => 'CRM_Event_BAO_Participant',
230 'FKClassName' => 'CRM_Contact_DAO_Contact',
233 'name' => 'event_id',
234 'type' => CRM_Utils_Type
::T_INT
,
235 'title' => ts('Event'),
236 'description' => 'FK to Event ID',
239 'where' => 'civicrm_participant.event_id',
240 'headerPattern' => '/event id$/i',
243 'table_name' => 'civicrm_participant',
244 'entity' => 'Participant',
245 'bao' => 'CRM_Event_BAO_Participant',
247 'FKClassName' => 'CRM_Event_DAO_Event',
249 'participant_status_id' => [
250 'name' => 'status_id',
251 'type' => CRM_Utils_Type
::T_INT
,
252 'title' => ts('Participant Status'),
253 'description' => 'Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.',
256 'where' => 'civicrm_participant.status_id',
257 'headerPattern' => '/(participant.)?(status)$/i',
261 'table_name' => 'civicrm_participant',
262 'entity' => 'Participant',
263 'bao' => 'CRM_Event_BAO_Participant',
265 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
269 'pseudoconstant' => [
270 'table' => 'civicrm_participant_status_type',
272 'labelColumn' => 'label',
275 'participant_role_id' => [
277 'type' => CRM_Utils_Type
::T_STRING
,
278 'title' => ts('Participant Role'),
279 'description' => 'Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.',
281 'size' => CRM_Utils_Type
::HUGE
,
283 'where' => 'civicrm_participant.role_id',
284 'headerPattern' => '/(participant.)?(role)$/i',
288 'table_name' => 'civicrm_participant',
289 'entity' => 'Participant',
290 'bao' => 'CRM_Event_BAO_Participant',
292 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
296 'pseudoconstant' => [
297 'optionGroupName' => 'participant_role',
298 'optionEditPath' => 'civicrm/admin/options/participant_role',
301 'participant_register_date' => [
302 'name' => 'register_date',
303 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
304 'title' => ts('Register date'),
305 'description' => 'When did contact register for event?',
307 'where' => 'civicrm_participant.register_date',
308 'headerPattern' => '/^(r(egister\s)?date)$/i',
311 'table_name' => 'civicrm_participant',
312 'entity' => 'Participant',
313 'bao' => 'CRM_Event_BAO_Participant',
316 'type' => 'Select Date',
317 'formatType' => 'activityDateTime',
320 'participant_source' => [
322 'type' => CRM_Utils_Type
::T_STRING
,
323 'title' => ts('Participant Source'),
324 'description' => 'Source of this event registration.',
326 'size' => CRM_Utils_Type
::HUGE
,
328 'where' => 'civicrm_participant.source',
329 'headerPattern' => '/(participant.)?(source)$/i',
332 'table_name' => 'civicrm_participant',
333 'entity' => 'Participant',
334 'bao' => 'CRM_Event_BAO_Participant',
337 'participant_fee_level' => [
338 'name' => 'fee_level',
339 'type' => CRM_Utils_Type
::T_TEXT
,
340 'title' => ts('Fee level'),
341 'description' => 'Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
342 we store the label value and not the key
345 'where' => 'civicrm_participant.fee_level',
346 'headerPattern' => '/^(f(ee\s)?level)$/i',
349 'table_name' => 'civicrm_participant',
350 'entity' => 'Participant',
351 'bao' => 'CRM_Event_BAO_Participant',
353 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
355 'participant_is_test' => [
357 'type' => CRM_Utils_Type
::T_BOOLEAN
,
358 'title' => ts('Test'),
360 'where' => 'civicrm_participant.is_test',
361 'headerPattern' => '',
364 'table_name' => 'civicrm_participant',
365 'entity' => 'Participant',
366 'bao' => 'CRM_Event_BAO_Participant',
369 'participant_is_pay_later' => [
370 'name' => 'is_pay_later',
371 'type' => CRM_Utils_Type
::T_BOOLEAN
,
372 'title' => ts('Is Pay Later'),
374 'where' => 'civicrm_participant.is_pay_later',
375 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
378 'table_name' => 'civicrm_participant',
379 'entity' => 'Participant',
380 'bao' => 'CRM_Event_BAO_Participant',
383 'participant_fee_amount' => [
384 'name' => 'fee_amount',
385 'type' => CRM_Utils_Type
::T_MONEY
,
386 'title' => ts('Fee Amount'),
387 'description' => 'actual processor fee if known - may be 0.',
393 'where' => 'civicrm_participant.fee_amount',
394 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
395 'dataPattern' => '/^\d+(\.\d{2})?$/',
397 'table_name' => 'civicrm_participant',
398 'entity' => 'Participant',
399 'bao' => 'CRM_Event_BAO_Participant',
402 'participant_registered_by_id' => [
403 'name' => 'registered_by_id',
404 'type' => CRM_Utils_Type
::T_INT
,
405 'title' => ts('Registered By ID'),
406 'description' => 'FK to Participant ID',
408 'where' => 'civicrm_participant.registered_by_id',
409 'headerPattern' => '',
413 'table_name' => 'civicrm_participant',
414 'entity' => 'Participant',
415 'bao' => 'CRM_Event_BAO_Participant',
417 'FKClassName' => 'CRM_Event_DAO_Participant',
419 'participant_discount_id' => [
420 'name' => 'discount_id',
421 'type' => CRM_Utils_Type
::T_INT
,
422 'title' => ts('Discount ID'),
423 'description' => 'FK to Discount ID',
425 'table_name' => 'civicrm_participant',
426 'entity' => 'Participant',
427 'bao' => 'CRM_Event_BAO_Participant',
429 'FKClassName' => 'CRM_Core_DAO_Discount',
431 'participant_fee_currency' => [
432 'name' => 'fee_currency',
433 'type' => CRM_Utils_Type
::T_STRING
,
434 'title' => ts('Fee Currency'),
435 'description' => '3 character string, value derived from config setting.',
437 'size' => CRM_Utils_Type
::FOUR
,
439 'where' => 'civicrm_participant.fee_currency',
440 'headerPattern' => '/(fee)?.?cur(rency)?/i',
441 'dataPattern' => '/^[A-Z]{3}$/i',
444 'table_name' => 'civicrm_participant',
445 'entity' => 'Participant',
446 'bao' => 'CRM_Event_BAO_Participant',
451 'pseudoconstant' => [
452 'table' => 'civicrm_currency',
453 'keyColumn' => 'name',
454 'labelColumn' => 'full_name',
455 'nameColumn' => 'name',
458 'participant_campaign_id' => [
459 'name' => 'campaign_id',
460 'type' => CRM_Utils_Type
::T_INT
,
461 'title' => ts('Campaign'),
462 'description' => 'The campaign for which this participant has been registered.',
464 'where' => 'civicrm_participant.campaign_id',
465 'headerPattern' => '',
468 'table_name' => 'civicrm_participant',
469 'entity' => 'Participant',
470 'bao' => 'CRM_Event_BAO_Participant',
472 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
473 'pseudoconstant' => [
474 'table' => 'civicrm_campaign',
476 'labelColumn' => 'title',
479 'discount_amount' => [
480 'name' => 'discount_amount',
481 'type' => CRM_Utils_Type
::T_INT
,
482 'title' => ts('Discount Amount'),
483 'description' => 'Discount Amount',
484 'table_name' => 'civicrm_participant',
485 'entity' => 'Participant',
486 'bao' => 'CRM_Event_BAO_Participant',
491 'type' => CRM_Utils_Type
::T_INT
,
492 'title' => ts('Event Cart ID'),
493 'description' => 'FK to civicrm_event_carts',
494 'table_name' => 'civicrm_participant',
495 'entity' => 'Participant',
496 'bao' => 'CRM_Event_BAO_Participant',
498 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
501 'name' => 'must_wait',
502 'type' => CRM_Utils_Type
::T_INT
,
503 'title' => ts('Must Wait on List'),
504 'description' => 'On Waiting List',
505 'table_name' => 'civicrm_participant',
506 'entity' => 'Participant',
507 'bao' => 'CRM_Event_BAO_Participant',
510 'transferred_to_contact_id' => [
511 'name' => 'transferred_to_contact_id',
512 'type' => CRM_Utils_Type
::T_INT
,
513 'title' => ts('Transferred to Contact ID'),
514 'description' => 'FK to Contact ID',
516 'where' => 'civicrm_participant.transferred_to_contact_id',
517 'headerPattern' => '/transfer(.?id)?/i',
521 'table_name' => 'civicrm_participant',
522 'entity' => 'Participant',
523 'bao' => 'CRM_Event_BAO_Participant',
525 'FKClassName' => 'CRM_Contact_DAO_Contact',
528 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
530 return Civi
::$statics[__CLASS__
]['fields'];
534 * Return a mapping from field-name to the corresponding key (as used in fields()).
537 * Array(string $name => string $uniqueName).
539 public static function &fieldKeys() {
540 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
541 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
543 return Civi
::$statics[__CLASS__
]['fieldKeys'];
547 * Returns the names of this table
551 public static function getTableName() {
552 return self
::$_tableName;
556 * Returns if this table needs to be logged
560 public function getLog() {
565 * Returns the list of fields that can be imported
567 * @param bool $prefix
571 public static function &import($prefix = FALSE) {
572 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
577 * Returns the list of fields that can be exported
579 * @param bool $prefix
583 public static function &export($prefix = FALSE) {
584 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
589 * Returns the list of indices
591 * @param bool $localize
595 public static function indices($localize = TRUE) {
597 'index_status_id' => [
598 'name' => 'index_status_id',
602 'localizable' => FALSE,
603 'sig' => 'civicrm_participant::0::status_id',
606 'name' => 'index_role_id',
610 'localizable' => FALSE,
611 'sig' => 'civicrm_participant::0::role_id',
614 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;