Merge pull request #21537 from eileenmcnaughton/ev_token2
[civicrm-core.git] / CRM / Event / DAO / ParticipantPayment.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Event/ParticipantPayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:faf8b6394f4e57dd2bd6702f712f7157)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the ParticipantPayment entity.
f41f0342 14 */
e501603b 15class CRM_Event_DAO_ParticipantPayment extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.7';
d31fb4e3 18 const COMPONENT = 'CiviEvent';
c3fc2621 19
e501603b 20 /**
f41f0342 21 * Static instance to hold the table name.
e501603b
TO
22 *
23 * @var string
24 */
fa45b5b9 25 public static $_tableName = 'civicrm_participant_payment';
c3fc2621 26
e501603b 27 /**
f41f0342 28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 29 *
c3fc2621 30 * @var bool
e501603b 31 */
fa45b5b9 32 public static $_log = TRUE;
c3fc2621 33
e501603b 34 /**
2cbbebe8 35 * Participant Payment ID
e501603b 36 *
e6ca0a57 37 * @var int
e501603b
TO
38 */
39 public $id;
c3fc2621 40
e501603b 41 /**
2cbbebe8 42 * Participant ID (FK)
e501603b 43 *
e6ca0a57 44 * @var int
e501603b
TO
45 */
46 public $participant_id;
c3fc2621 47
e501603b
TO
48 /**
49 * FK to contribution table.
50 *
e6ca0a57 51 * @var int
e501603b
TO
52 */
53 public $contribution_id;
c3fc2621 54
e501603b 55 /**
f41f0342 56 * Class constructor.
e501603b 57 */
c3fc2621 58 public function __construct() {
e501603b
TO
59 $this->__table = 'civicrm_participant_payment';
60 parent::__construct();
61 }
c3fc2621 62
449c4e6b
CW
63 /**
64 * Returns localized title of this entity.
7b66c3b5
AH
65 *
66 * @param bool $plural
67 * Whether to return the plural version of the title.
449c4e6b 68 */
7b66c3b5
AH
69 public static function getEntityTitle($plural = FALSE) {
70 return $plural ? ts('Participant Payments') : ts('Participant Payment');
449c4e6b
CW
71 }
72
e501603b 73 /**
f41f0342 74 * Returns foreign keys and entity references.
e501603b
TO
75 *
76 * @return array
77 * [CRM_Core_Reference_Interface]
78 */
c3fc2621 79 public static function getReferenceColumns() {
346aaaba 80 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 81 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
82 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'participant_id', 'civicrm_participant', 'id');
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
346aaaba 84 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 85 }
346aaaba 86 return Civi::$statics[__CLASS__]['links'];
e501603b 87 }
c3fc2621 88
e501603b
TO
89 /**
90 * Returns all the column names of this table
91 *
92 * @return array
93 */
c3fc2621 94 public static function &fields() {
346aaaba 95 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
96 Civi::$statics[__CLASS__]['fields'] = [
97 'id' => [
e501603b
TO
98 'name' => 'id',
99 'type' => CRM_Utils_Type::T_INT,
c3fc2621 100 'title' => ts('Payment ID'),
2cbbebe8 101 'description' => ts('Participant Payment ID'),
c3fc2621 102 'required' => TRUE,
a36434b9 103 'where' => 'civicrm_participant_payment.id',
522a26c9 104 'table_name' => 'civicrm_participant_payment',
105 'entity' => 'ParticipantPayment',
106 'bao' => 'CRM_Event_BAO_ParticipantPayment',
6a7e5e5d 107 'localizable' => 0,
2cbbebe8
A
108 'html' => [
109 'type' => 'Number',
110 ],
1fe423d6 111 'readonly' => TRUE,
a9d0587b 112 'add' => '1.7',
c3fc2621
CW
113 ],
114 'participant_id' => [
e501603b
TO
115 'name' => 'participant_id',
116 'type' => CRM_Utils_Type::T_INT,
c3fc2621 117 'title' => ts('Participant ID'),
2cbbebe8 118 'description' => ts('Participant ID (FK)'),
c3fc2621 119 'required' => TRUE,
a36434b9 120 'where' => 'civicrm_participant_payment.participant_id',
522a26c9 121 'table_name' => 'civicrm_participant_payment',
122 'entity' => 'ParticipantPayment',
123 'bao' => 'CRM_Event_BAO_ParticipantPayment',
6a7e5e5d 124 'localizable' => 0,
e501603b 125 'FKClassName' => 'CRM_Event_DAO_Participant',
2cbbebe8
A
126 'html' => [
127 'label' => ts("Participant"),
128 ],
a9d0587b 129 'add' => '1.7',
c3fc2621
CW
130 ],
131 'contribution_id' => [
e501603b
TO
132 'name' => 'contribution_id',
133 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 134 'title' => ts('Contribution ID'),
215b423e 135 'description' => ts('FK to contribution table.'),
c3fc2621 136 'required' => TRUE,
a36434b9 137 'where' => 'civicrm_participant_payment.contribution_id',
522a26c9 138 'table_name' => 'civicrm_participant_payment',
139 'entity' => 'ParticipantPayment',
140 'bao' => 'CRM_Event_BAO_ParticipantPayment',
6a7e5e5d 141 'localizable' => 0,
e501603b 142 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
2cbbebe8
A
143 'html' => [
144 'label' => ts("Contribution"),
145 ],
a9d0587b 146 'add' => '2.0',
c3fc2621
CW
147 ],
148 ];
346aaaba 149 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 150 }
346aaaba 151 return Civi::$statics[__CLASS__]['fields'];
e501603b 152 }
c3fc2621 153
e501603b 154 /**
bd8e0b14 155 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
156 *
157 * @return array
bd8e0b14 158 * Array(string $name => string $uniqueName).
e501603b 159 */
c3fc2621 160 public static function &fieldKeys() {
bd8e0b14
TO
161 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
162 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 163 }
bd8e0b14 164 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 165 }
c3fc2621 166
e501603b
TO
167 /**
168 * Returns the names of this table
169 *
170 * @return string
171 */
c3fc2621 172 public static function getTableName() {
e501603b
TO
173 return self::$_tableName;
174 }
c3fc2621 175
e501603b
TO
176 /**
177 * Returns if this table needs to be logged
178 *
c3fc2621 179 * @return bool
e501603b 180 */
c3fc2621 181 public function getLog() {
e501603b
TO
182 return self::$_log;
183 }
c3fc2621 184
e501603b
TO
185 /**
186 * Returns the list of fields that can be imported
187 *
188 * @param bool $prefix
189 *
190 * @return array
191 */
c3fc2621
CW
192 public static function &import($prefix = FALSE) {
193 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant_payment', $prefix, []);
60808919 194 return $r;
e501603b 195 }
c3fc2621 196
e501603b
TO
197 /**
198 * Returns the list of fields that can be exported
199 *
200 * @param bool $prefix
201 *
202 * @return array
203 */
c3fc2621
CW
204 public static function &export($prefix = FALSE) {
205 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant_payment', $prefix, []);
60808919 206 return $r;
e501603b 207 }
c3fc2621 208
e7a6b91a
AS
209 /**
210 * Returns the list of indices
c3fc2621
CW
211 *
212 * @param bool $localize
213 *
214 * @return array
e7a6b91a
AS
215 */
216 public static function indices($localize = TRUE) {
c3fc2621
CW
217 $indices = [
218 'UI_contribution_participant' => [
e7a6b91a 219 'name' => 'UI_contribution_participant',
c3fc2621 220 'field' => [
e7a6b91a
AS
221 0 => 'contribution_id',
222 1 => 'participant_id',
c3fc2621
CW
223 ],
224 'localizable' => FALSE,
225 'unique' => TRUE,
e7a6b91a 226 'sig' => 'civicrm_participant_payment::1::contribution_id::participant_id',
c3fc2621
CW
227 ],
228 ];
e7a6b91a
AS
229 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
230 }
c3fc2621 231
e501603b 232}