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