API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Pledge / DAO / PledgePayment.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Pledge/PledgePayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:64c6aef9e06ba7320d917ec5515c5ffc)
10 */
11
12 /**
13 * Database access object for the PledgePayment entity.
14 */
15 class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_pledge_payment';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = TRUE;
30
31 /**
32 * @var int
33 */
34 public $id;
35
36 /**
37 * FK to Pledge table
38 *
39 * @var int
40 */
41 public $pledge_id;
42
43 /**
44 * FK to contribution table.
45 *
46 * @var int
47 */
48 public $contribution_id;
49
50 /**
51 * Pledged amount for this payment (the actual contribution amount might be different).
52 *
53 * @var float
54 */
55 public $scheduled_amount;
56
57 /**
58 * Actual amount that is paid as the Pledged installment amount.
59 *
60 * @var float
61 */
62 public $actual_amount;
63
64 /**
65 * 3 character string, value from config setting or input via user.
66 *
67 * @var string
68 */
69 public $currency;
70
71 /**
72 * The date the pledge payment is supposed to happen.
73 *
74 * @var datetime
75 */
76 public $scheduled_date;
77
78 /**
79 * The date that the most recent payment reminder was sent.
80 *
81 * @var datetime
82 */
83 public $reminder_date;
84
85 /**
86 * The number of payment reminders sent.
87 *
88 * @var int
89 */
90 public $reminder_count;
91
92 /**
93 * @var int
94 */
95 public $status_id;
96
97 /**
98 * Class constructor.
99 */
100 public function __construct() {
101 $this->__table = 'civicrm_pledge_payment';
102 parent::__construct();
103 }
104
105 /**
106 * Returns localized title of this entity.
107 */
108 public static function getEntityTitle() {
109 return ts('Pledge Payments');
110 }
111
112 /**
113 * Returns foreign keys and entity references.
114 *
115 * @return array
116 * [CRM_Core_Reference_Interface]
117 */
118 public static function getReferenceColumns() {
119 if (!isset(Civi::$statics[__CLASS__]['links'])) {
120 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
121 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'pledge_id', 'civicrm_pledge', 'id');
122 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
123 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
124 }
125 return Civi::$statics[__CLASS__]['links'];
126 }
127
128 /**
129 * Returns all the column names of this table
130 *
131 * @return array
132 */
133 public static function &fields() {
134 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
135 Civi::$statics[__CLASS__]['fields'] = [
136 'pledge_payment_id' => [
137 'name' => 'id',
138 'type' => CRM_Utils_Type::T_INT,
139 'title' => ts('Payment ID'),
140 'required' => TRUE,
141 'import' => TRUE,
142 'where' => 'civicrm_pledge_payment.id',
143 'export' => TRUE,
144 'table_name' => 'civicrm_pledge_payment',
145 'entity' => 'PledgePayment',
146 'bao' => 'CRM_Pledge_BAO_PledgePayment',
147 'localizable' => 0,
148 'add' => '2.1',
149 ],
150 'pledge_id' => [
151 'name' => 'pledge_id',
152 'type' => CRM_Utils_Type::T_INT,
153 'title' => ts('Pledge'),
154 'description' => ts('FK to Pledge table'),
155 'required' => TRUE,
156 'where' => 'civicrm_pledge_payment.pledge_id',
157 'table_name' => 'civicrm_pledge_payment',
158 'entity' => 'PledgePayment',
159 'bao' => 'CRM_Pledge_BAO_PledgePayment',
160 'localizable' => 0,
161 'FKClassName' => 'CRM_Pledge_DAO_Pledge',
162 'add' => '2.1',
163 ],
164 'contribution_id' => [
165 'name' => 'contribution_id',
166 'type' => CRM_Utils_Type::T_INT,
167 'title' => ts('Contribution'),
168 'description' => ts('FK to contribution table.'),
169 'where' => 'civicrm_pledge_payment.contribution_id',
170 'table_name' => 'civicrm_pledge_payment',
171 'entity' => 'PledgePayment',
172 'bao' => 'CRM_Pledge_BAO_PledgePayment',
173 'localizable' => 0,
174 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
175 'add' => '2.1',
176 ],
177 'pledge_payment_scheduled_amount' => [
178 'name' => 'scheduled_amount',
179 'type' => CRM_Utils_Type::T_MONEY,
180 'title' => ts('Scheduled Amount'),
181 'description' => ts('Pledged amount for this payment (the actual contribution amount might be different).'),
182 'required' => TRUE,
183 'precision' => [
184 20,
185 2,
186 ],
187 'import' => TRUE,
188 'where' => 'civicrm_pledge_payment.scheduled_amount',
189 'export' => TRUE,
190 'table_name' => 'civicrm_pledge_payment',
191 'entity' => 'PledgePayment',
192 'bao' => 'CRM_Pledge_BAO_PledgePayment',
193 'localizable' => 0,
194 'add' => '2.1',
195 ],
196 'pledge_payment_actual_amount' => [
197 'name' => 'actual_amount',
198 'type' => CRM_Utils_Type::T_MONEY,
199 'title' => ts('Actual Amount'),
200 'description' => ts('Actual amount that is paid as the Pledged installment amount.'),
201 'precision' => [
202 20,
203 2,
204 ],
205 'import' => TRUE,
206 'where' => 'civicrm_pledge_payment.actual_amount',
207 'export' => TRUE,
208 'table_name' => 'civicrm_pledge_payment',
209 'entity' => 'PledgePayment',
210 'bao' => 'CRM_Pledge_BAO_PledgePayment',
211 'localizable' => 0,
212 'add' => '3.2',
213 ],
214 'currency' => [
215 'name' => 'currency',
216 'type' => CRM_Utils_Type::T_STRING,
217 'title' => ts('Currency'),
218 'description' => ts('3 character string, value from config setting or input via user.'),
219 'maxlength' => 3,
220 'size' => CRM_Utils_Type::FOUR,
221 'where' => 'civicrm_pledge_payment.currency',
222 'default' => 'NULL',
223 'table_name' => 'civicrm_pledge_payment',
224 'entity' => 'PledgePayment',
225 'bao' => 'CRM_Pledge_BAO_PledgePayment',
226 'localizable' => 0,
227 'html' => [
228 'type' => 'Select',
229 ],
230 'pseudoconstant' => [
231 'table' => 'civicrm_currency',
232 'keyColumn' => 'name',
233 'labelColumn' => 'full_name',
234 'nameColumn' => 'name',
235 'abbrColumn' => 'symbol',
236 ],
237 'add' => '3.2',
238 ],
239 'pledge_payment_scheduled_date' => [
240 'name' => 'scheduled_date',
241 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
242 'title' => ts('Scheduled Date'),
243 'description' => ts('The date the pledge payment is supposed to happen.'),
244 'required' => TRUE,
245 'import' => TRUE,
246 'where' => 'civicrm_pledge_payment.scheduled_date',
247 'export' => TRUE,
248 'table_name' => 'civicrm_pledge_payment',
249 'entity' => 'PledgePayment',
250 'bao' => 'CRM_Pledge_BAO_PledgePayment',
251 'localizable' => 0,
252 'unique_title' => ts('Payment Scheduled'),
253 'html' => [
254 'type' => 'Select Date',
255 'formatType' => 'activityDate',
256 ],
257 'add' => '2.1',
258 ],
259 'pledge_payment_reminder_date' => [
260 'name' => 'reminder_date',
261 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
262 'title' => ts('Last Reminder'),
263 'description' => ts('The date that the most recent payment reminder was sent.'),
264 'import' => TRUE,
265 'where' => 'civicrm_pledge_payment.reminder_date',
266 'export' => TRUE,
267 'table_name' => 'civicrm_pledge_payment',
268 'entity' => 'PledgePayment',
269 'bao' => 'CRM_Pledge_BAO_PledgePayment',
270 'localizable' => 0,
271 'add' => '2.1',
272 ],
273 'pledge_payment_reminder_count' => [
274 'name' => 'reminder_count',
275 'type' => CRM_Utils_Type::T_INT,
276 'title' => ts('Reminders Sent'),
277 'description' => ts('The number of payment reminders sent.'),
278 'import' => TRUE,
279 'where' => 'civicrm_pledge_payment.reminder_count',
280 'export' => TRUE,
281 'default' => '0',
282 'table_name' => 'civicrm_pledge_payment',
283 'entity' => 'PledgePayment',
284 'bao' => 'CRM_Pledge_BAO_PledgePayment',
285 'localizable' => 0,
286 'add' => '2.1',
287 ],
288 'pledge_payment_status_id' => [
289 'name' => 'status_id',
290 'type' => CRM_Utils_Type::T_INT,
291 'title' => ts('Payment Status'),
292 'import' => TRUE,
293 'where' => 'civicrm_pledge_payment.status_id',
294 'export' => FALSE,
295 'table_name' => 'civicrm_pledge_payment',
296 'entity' => 'PledgePayment',
297 'bao' => 'CRM_Pledge_BAO_PledgePayment',
298 'localizable' => 0,
299 'pseudoconstant' => [
300 'optionGroupName' => 'contribution_status',
301 'optionEditPath' => 'civicrm/admin/options/contribution_status',
302 ],
303 'add' => '2.1',
304 ],
305 ];
306 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
307 }
308 return Civi::$statics[__CLASS__]['fields'];
309 }
310
311 /**
312 * Return a mapping from field-name to the corresponding key (as used in fields()).
313 *
314 * @return array
315 * Array(string $name => string $uniqueName).
316 */
317 public static function &fieldKeys() {
318 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
319 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
320 }
321 return Civi::$statics[__CLASS__]['fieldKeys'];
322 }
323
324 /**
325 * Returns the names of this table
326 *
327 * @return string
328 */
329 public static function getTableName() {
330 return self::$_tableName;
331 }
332
333 /**
334 * Returns if this table needs to be logged
335 *
336 * @return bool
337 */
338 public function getLog() {
339 return self::$_log;
340 }
341
342 /**
343 * Returns the list of fields that can be imported
344 *
345 * @param bool $prefix
346 *
347 * @return array
348 */
349 public static function &import($prefix = FALSE) {
350 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge_payment', $prefix, []);
351 return $r;
352 }
353
354 /**
355 * Returns the list of fields that can be exported
356 *
357 * @param bool $prefix
358 *
359 * @return array
360 */
361 public static function &export($prefix = FALSE) {
362 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge_payment', $prefix, []);
363 return $r;
364 }
365
366 /**
367 * Returns the list of indices
368 *
369 * @param bool $localize
370 *
371 * @return array
372 */
373 public static function indices($localize = TRUE) {
374 $indices = [
375 'index_contribution_pledge' => [
376 'name' => 'index_contribution_pledge',
377 'field' => [
378 0 => 'contribution_id',
379 1 => 'pledge_id',
380 ],
381 'localizable' => FALSE,
382 'sig' => 'civicrm_pledge_payment::0::contribution_id::pledge_id',
383 ],
384 'index_status' => [
385 'name' => 'index_status',
386 'field' => [
387 0 => 'status_id',
388 ],
389 'localizable' => FALSE,
390 'sig' => 'civicrm_pledge_payment::0::status_id',
391 ],
392 ];
393 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
394 }
395
396 }