Merge pull request #22438 from eileenmcnaughton/format
[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:e968c8fec853683ccda7863407aef635)
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|string|null
38 * (SQL type: int unsigned)
39 * Note that values will be retrieved from the database as a string.
40 */
41 public $id;
42
43 /**
44 * Participant ID (FK)
45 *
46 * @var int|string
47 * (SQL type: int unsigned)
48 * Note that values will be retrieved from the database as a string.
49 */
50 public $participant_id;
51
52 /**
53 * FK to contribution table.
54 *
55 * @var int|string
56 * (SQL type: int unsigned)
57 * Note that values will be retrieved from the database as a string.
58 */
59 public $contribution_id;
60
61 /**
62 * Class constructor.
63 */
64 public function __construct() {
65 $this->__table = 'civicrm_participant_payment';
66 parent::__construct();
67 }
68
69 /**
70 * Returns localized title of this entity.
71 *
72 * @param bool $plural
73 * Whether to return the plural version of the title.
74 */
75 public static function getEntityTitle($plural = FALSE) {
76 return $plural ? ts('Participant Payments') : ts('Participant Payment');
77 }
78
79 /**
80 * Returns foreign keys and entity references.
81 *
82 * @return array
83 * [CRM_Core_Reference_Interface]
84 */
85 public static function getReferenceColumns() {
86 if (!isset(Civi::$statics[__CLASS__]['links'])) {
87 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
88 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'participant_id', 'civicrm_participant', 'id');
89 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
90 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
91 }
92 return Civi::$statics[__CLASS__]['links'];
93 }
94
95 /**
96 * Returns all the column names of this table
97 *
98 * @return array
99 */
100 public static function &fields() {
101 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
102 Civi::$statics[__CLASS__]['fields'] = [
103 'id' => [
104 'name' => 'id',
105 'type' => CRM_Utils_Type::T_INT,
106 'title' => ts('Payment ID'),
107 'description' => ts('Participant Payment ID'),
108 'required' => TRUE,
109 'where' => 'civicrm_participant_payment.id',
110 'table_name' => 'civicrm_participant_payment',
111 'entity' => 'ParticipantPayment',
112 'bao' => 'CRM_Event_BAO_ParticipantPayment',
113 'localizable' => 0,
114 'html' => [
115 'type' => 'Number',
116 ],
117 'readonly' => TRUE,
118 'add' => '1.7',
119 ],
120 'participant_id' => [
121 'name' => 'participant_id',
122 'type' => CRM_Utils_Type::T_INT,
123 'title' => ts('Participant ID'),
124 'description' => ts('Participant ID (FK)'),
125 'required' => TRUE,
126 'where' => 'civicrm_participant_payment.participant_id',
127 'table_name' => 'civicrm_participant_payment',
128 'entity' => 'ParticipantPayment',
129 'bao' => 'CRM_Event_BAO_ParticipantPayment',
130 'localizable' => 0,
131 'FKClassName' => 'CRM_Event_DAO_Participant',
132 'html' => [
133 'label' => ts("Participant"),
134 ],
135 'add' => '1.7',
136 ],
137 'contribution_id' => [
138 'name' => 'contribution_id',
139 'type' => CRM_Utils_Type::T_INT,
140 'title' => ts('Contribution ID'),
141 'description' => ts('FK to contribution table.'),
142 'required' => TRUE,
143 'where' => 'civicrm_participant_payment.contribution_id',
144 'table_name' => 'civicrm_participant_payment',
145 'entity' => 'ParticipantPayment',
146 'bao' => 'CRM_Event_BAO_ParticipantPayment',
147 'localizable' => 0,
148 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
149 'html' => [
150 'label' => ts("Contribution"),
151 ],
152 'add' => '2.0',
153 ],
154 ];
155 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
156 }
157 return Civi::$statics[__CLASS__]['fields'];
158 }
159
160 /**
161 * Return a mapping from field-name to the corresponding key (as used in fields()).
162 *
163 * @return array
164 * Array(string $name => string $uniqueName).
165 */
166 public static function &fieldKeys() {
167 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
168 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
169 }
170 return Civi::$statics[__CLASS__]['fieldKeys'];
171 }
172
173 /**
174 * Returns the names of this table
175 *
176 * @return string
177 */
178 public static function getTableName() {
179 return self::$_tableName;
180 }
181
182 /**
183 * Returns if this table needs to be logged
184 *
185 * @return bool
186 */
187 public function getLog() {
188 return self::$_log;
189 }
190
191 /**
192 * Returns the list of fields that can be imported
193 *
194 * @param bool $prefix
195 *
196 * @return array
197 */
198 public static function &import($prefix = FALSE) {
199 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'participant_payment', $prefix, []);
200 return $r;
201 }
202
203 /**
204 * Returns the list of fields that can be exported
205 *
206 * @param bool $prefix
207 *
208 * @return array
209 */
210 public static function &export($prefix = FALSE) {
211 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'participant_payment', $prefix, []);
212 return $r;
213 }
214
215 /**
216 * Returns the list of indices
217 *
218 * @param bool $localize
219 *
220 * @return array
221 */
222 public static function indices($localize = TRUE) {
223 $indices = [
224 'UI_contribution_participant' => [
225 'name' => 'UI_contribution_participant',
226 'field' => [
227 0 => 'contribution_id',
228 1 => 'participant_id',
229 ],
230 'localizable' => FALSE,
231 'unique' => TRUE,
232 'sig' => 'civicrm_participant_payment::1::contribution_id::participant_id',
233 ],
234 ];
235 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
236 }
237
238 }