5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Event/Participant.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:919ea3218803ca5851b09181115c1c58)
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 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
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',
209 'table_name' => 'civicrm_participant',
210 'entity' => 'Participant',
211 'bao' => 'CRM_Event_BAO_Participant',
214 'participant_contact_id' => [
215 'name' => 'contact_id',
216 'type' => CRM_Utils_Type
::T_INT
,
217 'title' => ts('Contact ID'),
218 'description' => ts('FK to Contact ID'),
221 'where' => 'civicrm_participant.contact_id',
222 'headerPattern' => '/contact(.?id)?/i',
224 'table_name' => 'civicrm_participant',
225 'entity' => 'Participant',
226 'bao' => 'CRM_Event_BAO_Participant',
228 'FKClassName' => 'CRM_Contact_DAO_Contact',
231 'name' => 'event_id',
232 'type' => CRM_Utils_Type
::T_INT
,
233 'title' => ts('Event'),
234 'description' => ts('FK to Event ID'),
237 'where' => 'civicrm_participant.event_id',
238 'headerPattern' => '/event id$/i',
240 'table_name' => 'civicrm_participant',
241 'entity' => 'Participant',
242 'bao' => 'CRM_Event_BAO_Participant',
244 'FKClassName' => 'CRM_Event_DAO_Event',
246 'participant_status_id' => [
247 'name' => 'status_id',
248 'type' => CRM_Utils_Type
::T_INT
,
249 'title' => ts('Participant Status'),
250 'description' => ts('Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.'),
253 'where' => 'civicrm_participant.status_id',
254 'headerPattern' => '/(participant.)?(status)$/i',
257 'table_name' => 'civicrm_participant',
258 'entity' => 'Participant',
259 'bao' => 'CRM_Event_BAO_Participant',
261 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType',
265 'pseudoconstant' => [
266 'table' => 'civicrm_participant_status_type',
268 'labelColumn' => 'label',
271 'participant_role_id' => [
273 'type' => CRM_Utils_Type
::T_STRING
,
274 'title' => ts('Participant Role'),
275 'description' => ts('Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.'),
277 'size' => CRM_Utils_Type
::HUGE
,
279 'where' => 'civicrm_participant.role_id',
280 'headerPattern' => '/(participant.)?(role)$/i',
283 'table_name' => 'civicrm_participant',
284 'entity' => 'Participant',
285 'bao' => 'CRM_Event_BAO_Participant',
287 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
291 'pseudoconstant' => [
292 'optionGroupName' => 'participant_role',
293 'optionEditPath' => 'civicrm/admin/options/participant_role',
296 'participant_register_date' => [
297 'name' => 'register_date',
298 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
299 'title' => ts('Register date'),
300 'description' => ts('When did contact register for event?'),
302 'where' => 'civicrm_participant.register_date',
303 'headerPattern' => '/^(r(egister\s)?date)$/i',
305 'table_name' => 'civicrm_participant',
306 'entity' => 'Participant',
307 'bao' => 'CRM_Event_BAO_Participant',
310 'type' => 'Select Date',
311 'formatType' => 'activityDateTime',
314 'participant_source' => [
316 'type' => CRM_Utils_Type
::T_STRING
,
317 'title' => ts('Participant Source'),
318 'description' => ts('Source of this event registration.'),
320 'size' => CRM_Utils_Type
::HUGE
,
322 'where' => 'civicrm_participant.source',
323 'headerPattern' => '/(participant.)?(source)$/i',
325 'table_name' => 'civicrm_participant',
326 'entity' => 'Participant',
327 'bao' => 'CRM_Event_BAO_Participant',
333 'participant_fee_level' => [
334 'name' => 'fee_level',
335 'type' => CRM_Utils_Type
::T_TEXT
,
336 'title' => ts('Fee level'),
337 'description' => ts('Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that
338 we store the label value and not the key'),
340 'where' => 'civicrm_participant.fee_level',
341 'headerPattern' => '/^(f(ee\s)?level)$/i',
343 'table_name' => 'civicrm_participant',
344 'entity' => 'Participant',
345 'bao' => 'CRM_Event_BAO_Participant',
347 'serialize' => self
::SERIALIZE_SEPARATOR_BOOKEND
,
349 'participant_is_test' => [
351 'type' => CRM_Utils_Type
::T_BOOLEAN
,
352 'title' => ts('Test'),
354 'where' => 'civicrm_participant.is_test',
357 'table_name' => 'civicrm_participant',
358 'entity' => 'Participant',
359 'bao' => 'CRM_Event_BAO_Participant',
362 'participant_is_pay_later' => [
363 'name' => 'is_pay_later',
364 'type' => CRM_Utils_Type
::T_BOOLEAN
,
365 'title' => ts('Is Pay Later'),
367 'where' => 'civicrm_participant.is_pay_later',
368 'headerPattern' => '/(is.)?(pay(.)?later)$/i',
371 'table_name' => 'civicrm_participant',
372 'entity' => 'Participant',
373 'bao' => 'CRM_Event_BAO_Participant',
376 'participant_fee_amount' => [
377 'name' => 'fee_amount',
378 'type' => CRM_Utils_Type
::T_MONEY
,
379 'title' => ts('Fee Amount'),
380 'description' => ts('actual processor fee if known - may be 0.'),
386 'where' => 'civicrm_participant.fee_amount',
387 'headerPattern' => '/fee(.?am(ou)?nt)?/i',
388 'dataPattern' => '/^\d+(\.\d{2})?$/',
390 'table_name' => 'civicrm_participant',
391 'entity' => 'Participant',
392 'bao' => 'CRM_Event_BAO_Participant',
395 'participant_registered_by_id' => [
396 'name' => 'registered_by_id',
397 'type' => CRM_Utils_Type
::T_INT
,
398 'title' => ts('Registered By ID'),
399 'description' => ts('FK to Participant ID'),
401 'where' => 'civicrm_participant.registered_by_id',
404 'table_name' => 'civicrm_participant',
405 'entity' => 'Participant',
406 'bao' => 'CRM_Event_BAO_Participant',
408 'FKClassName' => 'CRM_Event_DAO_Participant',
410 'participant_discount_id' => [
411 'name' => 'discount_id',
412 'type' => CRM_Utils_Type
::T_INT
,
413 'title' => ts('Discount ID'),
414 'description' => ts('FK to Discount ID'),
415 'where' => 'civicrm_participant.discount_id',
417 'table_name' => 'civicrm_participant',
418 'entity' => 'Participant',
419 'bao' => 'CRM_Event_BAO_Participant',
421 'FKClassName' => 'CRM_Core_DAO_Discount',
423 'participant_fee_currency' => [
424 'name' => 'fee_currency',
425 'type' => CRM_Utils_Type
::T_STRING
,
426 'title' => ts('Fee Currency'),
427 'description' => ts('3 character string, value derived from config setting.'),
429 'size' => CRM_Utils_Type
::FOUR
,
431 'where' => 'civicrm_participant.fee_currency',
432 'headerPattern' => '/(fee)?.?cur(rency)?/i',
433 'dataPattern' => '/^[A-Z]{3}$/i',
436 'table_name' => 'civicrm_participant',
437 'entity' => 'Participant',
438 'bao' => 'CRM_Event_BAO_Participant',
443 'pseudoconstant' => [
444 'table' => 'civicrm_currency',
445 'keyColumn' => 'name',
446 'labelColumn' => 'full_name',
447 'nameColumn' => 'name',
450 'participant_campaign_id' => [
451 'name' => 'campaign_id',
452 'type' => CRM_Utils_Type
::T_INT
,
453 'title' => ts('Campaign'),
454 'description' => ts('The campaign for which this participant has been registered.'),
456 'where' => 'civicrm_participant.campaign_id',
458 'table_name' => 'civicrm_participant',
459 'entity' => 'Participant',
460 'bao' => 'CRM_Event_BAO_Participant',
462 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
463 'pseudoconstant' => [
464 'table' => 'civicrm_campaign',
466 'labelColumn' => 'title',
469 'discount_amount' => [
470 'name' => 'discount_amount',
471 'type' => CRM_Utils_Type
::T_INT
,
472 'title' => ts('Discount Amount'),
473 'description' => ts('Discount Amount'),
474 'where' => 'civicrm_participant.discount_amount',
475 'table_name' => 'civicrm_participant',
476 'entity' => 'Participant',
477 'bao' => 'CRM_Event_BAO_Participant',
482 'type' => CRM_Utils_Type
::T_INT
,
483 'title' => ts('Event Cart ID'),
484 'description' => ts('FK to civicrm_event_carts'),
485 'where' => 'civicrm_participant.cart_id',
486 'table_name' => 'civicrm_participant',
487 'entity' => 'Participant',
488 'bao' => 'CRM_Event_BAO_Participant',
490 'FKClassName' => 'CRM_Event_Cart_DAO_Cart',
493 'name' => 'must_wait',
494 'type' => CRM_Utils_Type
::T_INT
,
495 'title' => ts('Must Wait on List'),
496 'description' => ts('On Waiting List'),
497 'where' => 'civicrm_participant.must_wait',
498 'table_name' => 'civicrm_participant',
499 'entity' => 'Participant',
500 'bao' => 'CRM_Event_BAO_Participant',
503 'transferred_to_contact_id' => [
504 'name' => 'transferred_to_contact_id',
505 'type' => CRM_Utils_Type
::T_INT
,
506 'title' => ts('Transferred to Contact ID'),
507 'description' => ts('FK to Contact ID'),
509 'where' => 'civicrm_participant.transferred_to_contact_id',
510 'headerPattern' => '/transfer(.?id)?/i',
513 'table_name' => 'civicrm_participant',
514 'entity' => 'Participant',
515 'bao' => 'CRM_Event_BAO_Participant',
517 'FKClassName' => 'CRM_Contact_DAO_Contact',
520 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
522 return Civi
::$statics[__CLASS__
]['fields'];
526 * Return a mapping from field-name to the corresponding key (as used in fields()).
529 * Array(string $name => string $uniqueName).
531 public static function &fieldKeys() {
532 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
533 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
535 return Civi
::$statics[__CLASS__
]['fieldKeys'];
539 * Returns the names of this table
543 public static function getTableName() {
544 return self
::$_tableName;
548 * Returns if this table needs to be logged
552 public function getLog() {
557 * Returns the list of fields that can be imported
559 * @param bool $prefix
563 public static function &import($prefix = FALSE) {
564 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'participant', $prefix, []);
569 * Returns the list of fields that can be exported
571 * @param bool $prefix
575 public static function &export($prefix = FALSE) {
576 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'participant', $prefix, []);
581 * Returns the list of indices
583 * @param bool $localize
587 public static function indices($localize = TRUE) {
589 'index_status_id' => [
590 'name' => 'index_status_id',
594 'localizable' => FALSE,
595 'sig' => 'civicrm_participant::0::status_id',
598 'name' => 'index_role_id',
602 'localizable' => FALSE,
603 'sig' => 'civicrm_participant::0::role_id',
606 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;