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:2fe76154a50c0317faace43c47c3456a)
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' => ts('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' => ts('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' => ts('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' => ts('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' => ts('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' => ts('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' => ts('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',
340 'participant_fee_level' => [
341 'name' => 'fee_level',
342 'type' => CRM_Utils_Type
::T_TEXT
,
343 'title' => ts('Fee level'),
344 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
345 we store the label value and not the key
348 'where' => 'civicrm_participant.fee_level',
349 'headerPattern' => '/^(f(ee\s)?level)$/i',
352 'table_name' => 'civicrm_participant',
353 'entity' => 'Participant',
354 'bao' => 'CRM_Event_BAO_Participant',
356 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
358 'participant_is_test' => [
360 'type' => CRM_Utils_Type
::T_BOOLEAN
,
361 'title' => ts('Test'),
363 'where' => 'civicrm_participant.is_test',
364 'headerPattern' => '',
368 'table_name' => 'civicrm_participant',
369 'entity' => 'Participant',
370 'bao' => 'CRM_Event_BAO_Participant',
373 'participant_is_pay_later' => [
374 'name' => 'is_pay_later',
375 'type' => CRM_Utils_Type
::T_BOOLEAN
,
376 'title' => ts('Is Pay Later'),
378 'where' => 'civicrm_participant.is_pay_later',
379 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
383 'table_name' => 'civicrm_participant',
384 'entity' => 'Participant',
385 'bao' => 'CRM_Event_BAO_Participant',
388 'participant_fee_amount' => [
389 'name' => 'fee_amount',
390 'type' => CRM_Utils_Type
::T_MONEY
,
391 'title' => ts('Fee Amount'),
392 'description' => ts('actual processor fee if known - may be 0.'),
398 'where' => 'civicrm_participant.fee_amount',
399 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
400 'dataPattern' => '/^\d+(\.\d{2})?$/',
402 'table_name' => 'civicrm_participant',
403 'entity' => 'Participant',
404 'bao' => 'CRM_Event_BAO_Participant',
407 'participant_registered_by_id' => [
408 'name' => 'registered_by_id',
409 'type' => CRM_Utils_Type
::T_INT
,
410 'title' => ts('Registered By ID'),
411 'description' => ts('FK to Participant ID'),
413 'where' => 'civicrm_participant.registered_by_id',
414 'headerPattern' => '',
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'),
430 'table_name' => 'civicrm_participant',
431 'entity' => 'Participant',
432 'bao' => 'CRM_Event_BAO_Participant',
434 'FKClassName' => 'CRM_Core_DAO_Discount',
436 'participant_fee_currency' => [
437 'name' => 'fee_currency',
438 'type' => CRM_Utils_Type
::T_STRING
,
439 'title' => ts('Fee Currency'),
440 'description' => ts('3 character string, value derived from config setting.'),
442 'size' => CRM_Utils_Type
::FOUR
,
444 'where' => 'civicrm_participant.fee_currency',
445 'headerPattern' => '/(fee)?.?cur(rency)?/i',
446 'dataPattern' => '/^[A-Z]{3}$/i',
449 'table_name' => 'civicrm_participant',
450 'entity' => 'Participant',
451 'bao' => 'CRM_Event_BAO_Participant',
456 'pseudoconstant' => [
457 'table' => 'civicrm_currency',
458 'keyColumn' => 'name',
459 'labelColumn' => 'full_name',
460 'nameColumn' => 'name',
463 'participant_campaign_id' => [
464 'name' => 'campaign_id',
465 'type' => CRM_Utils_Type
::T_INT
,
466 'title' => ts('Campaign'),
467 'description' => ts('The campaign for which this participant has been registered.'),
469 'where' => 'civicrm_participant.campaign_id',
470 'headerPattern' => '',
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 'table_name' => 'civicrm_participant',
490 'entity' => 'Participant',
491 'bao' => 'CRM_Event_BAO_Participant',
496 'type' => CRM_Utils_Type
::T_INT
,
497 'title' => ts('Event Cart ID'),
498 'description' => ts('FK to civicrm_event_carts'),
499 'table_name' => 'civicrm_participant',
500 'entity' => 'Participant',
501 'bao' => 'CRM_Event_BAO_Participant',
503 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
506 'name' => 'must_wait',
507 'type' => CRM_Utils_Type
::T_INT
,
508 'title' => ts('Must Wait on List'),
509 'description' => ts('On Waiting List'),
510 'table_name' => 'civicrm_participant',
511 'entity' => 'Participant',
512 'bao' => 'CRM_Event_BAO_Participant',
515 'transferred_to_contact_id' => [
516 'name' => 'transferred_to_contact_id',
517 'type' => CRM_Utils_Type
::T_INT
,
518 'title' => ts('Transferred to Contact ID'),
519 'description' => ts('FK to Contact ID'),
521 'where' => 'civicrm_participant.transferred_to_contact_id',
522 'headerPattern' => '/transfer(.?id)?/i',
526 'table_name' => 'civicrm_participant',
527 'entity' => 'Participant',
528 'bao' => 'CRM_Event_BAO_Participant',
530 'FKClassName' => 'CRM_Contact_DAO_Contact',
533 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
535 return Civi
::$statics[__CLASS__
]['fields'];
539 * Return a mapping from field-name to the corresponding key (as used in fields()).
542 * Array(string $name => string $uniqueName).
544 public static function &fieldKeys() {
545 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
546 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
548 return Civi
::$statics[__CLASS__
]['fieldKeys'];
552 * Returns the names of this table
556 public static function getTableName() {
557 return self
::$_tableName;
561 * Returns if this table needs to be logged
565 public function getLog() {
570 * Returns the list of fields that can be imported
572 * @param bool $prefix
576 public static function &import($prefix = FALSE) {
577 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
582 * Returns the list of fields that can be exported
584 * @param bool $prefix
588 public static function &export($prefix = FALSE) {
589 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
594 * Returns the list of indices
596 * @param bool $localize
600 public static function indices($localize = TRUE) {
602 'index_status_id' => [
603 'name' => 'index_status_id',
607 'localizable' => FALSE,
608 'sig' => 'civicrm_participant::0::status_id',
611 'name' => 'index_role_id',
615 'localizable' => FALSE,
616 'sig' => 'civicrm_participant::0::role_id',
619 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;