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