Merge pull request #14295 from eileenmcnaughton/dao_2
[civicrm-core.git] / CRM / Pledge / DAO / Pledge.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Pledge/Pledge.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
042043f1 9 * (GenCodeChecksum:9c9506c7bd637a29b5453c5f30749d9c)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Pledge entity.
f41f0342 14 */
e501603b 15class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_pledge';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b
TO
31 /**
32 * Pledge ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Foreign key to civicrm_contact.id .
40 *
41 * @var int unsigned
42 */
43 public $contact_id;
c3fc2621 44
e501603b
TO
45 /**
46 * FK to Financial Type
47 *
48 * @var int unsigned
49 */
50 public $financial_type_id;
c3fc2621 51
e501603b
TO
52 /**
53 * The Contribution Page which triggered this contribution
54 *
55 * @var int unsigned
56 */
57 public $contribution_page_id;
c3fc2621 58
e501603b
TO
59 /**
60 * Total pledged amount.
61 *
62 * @var float
63 */
64 public $amount;
c3fc2621 65
e501603b
TO
66 /**
67 * Original amount for each of the installments.
68 *
69 * @var float
70 */
71 public $original_installment_amount;
c3fc2621 72
e501603b
TO
73 /**
74 * 3 character string, value from config setting or input via user.
75 *
76 * @var string
77 */
78 public $currency;
c3fc2621 79
e501603b
TO
80 /**
81 * Time units for recurrence of pledge payments.
82 *
83 * @var string
84 */
85 public $frequency_unit;
c3fc2621 86
e501603b
TO
87 /**
88 * Number of time units for recurrence of pledge payments.
89 *
90 * @var int unsigned
91 */
92 public $frequency_interval;
c3fc2621 93
e501603b
TO
94 /**
95 * Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.
96 *
97 * @var int unsigned
98 */
99 public $frequency_day;
c3fc2621 100
e501603b
TO
101 /**
102 * Total number of payments to be made.
103 *
104 * @var int unsigned
105 */
106 public $installments;
c3fc2621 107
e501603b
TO
108 /**
109 * The date the first scheduled pledge occurs.
110 *
111 * @var datetime
112 */
113 public $start_date;
c3fc2621 114
e501603b
TO
115 /**
116 * When this pledge record was created.
117 *
118 * @var datetime
119 */
120 public $create_date;
c3fc2621 121
e501603b
TO
122 /**
123 * When a pledge acknowledgement message was sent to the contributor.
124 *
125 * @var datetime
126 */
127 public $acknowledge_date;
c3fc2621 128
e501603b
TO
129 /**
130 * Last updated date for this pledge record.
131 *
132 * @var datetime
133 */
134 public $modified_date;
c3fc2621 135
e501603b
TO
136 /**
137 * Date this pledge was cancelled by contributor.
138 *
139 * @var datetime
140 */
141 public $cancel_date;
c3fc2621 142
e501603b
TO
143 /**
144 * Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).
145 *
146 * @var datetime
147 */
148 public $end_date;
c3fc2621 149
e501603b
TO
150 /**
151 * The maximum number of payment reminders to send for any given payment.
152 *
153 * @var int unsigned
154 */
155 public $max_reminders;
c3fc2621 156
e501603b
TO
157 /**
158 * Send initial reminder this many days prior to the payment due date.
159 *
160 * @var int unsigned
161 */
162 public $initial_reminder_day;
c3fc2621 163
e501603b
TO
164 /**
165 * Send additional reminder this many days after last one sent, up to maximum number of reminders.
166 *
167 * @var int unsigned
168 */
169 public $additional_reminder_day;
c3fc2621 170
e501603b 171 /**
01dac399 172 * Implicit foreign key to civicrm_option_values in the pledge_status option group.
e501603b
TO
173 *
174 * @var int unsigned
175 */
176 public $status_id;
c3fc2621 177
e501603b 178 /**
e501603b
TO
179 * @var boolean
180 */
181 public $is_test;
c3fc2621 182
e501603b
TO
183 /**
184 * The campaign for which this pledge has been initiated.
185 *
186 * @var int unsigned
187 */
188 public $campaign_id;
c3fc2621 189
e501603b 190 /**
f41f0342 191 * Class constructor.
e501603b 192 */
c3fc2621 193 public function __construct() {
e501603b
TO
194 $this->__table = 'civicrm_pledge';
195 parent::__construct();
196 }
c3fc2621 197
e501603b 198 /**
f41f0342 199 * Returns foreign keys and entity references.
e501603b
TO
200 *
201 * @return array
202 * [CRM_Core_Reference_Interface]
203 */
c3fc2621 204 public static function getReferenceColumns() {
346aaaba 205 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 206 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
207 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
208 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
209 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_page_id', 'civicrm_contribution_page', 'id');
210 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
346aaaba 211 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 212 }
346aaaba 213 return Civi::$statics[__CLASS__]['links'];
e501603b 214 }
c3fc2621 215
e501603b
TO
216 /**
217 * Returns all the column names of this table
218 *
219 * @return array
220 */
c3fc2621 221 public static function &fields() {
346aaaba 222 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
223 Civi::$statics[__CLASS__]['fields'] = [
224 'pledge_id' => [
e501603b
TO
225 'name' => 'id',
226 'type' => CRM_Utils_Type::T_INT,
c3fc2621 227 'title' => ts('Pledge ID'),
215b423e 228 'description' => ts('Pledge ID'),
c3fc2621
CW
229 'required' => TRUE,
230 'import' => TRUE,
e501603b 231 'where' => 'civicrm_pledge.id',
c3fc2621 232 'export' => TRUE,
522a26c9 233 'table_name' => 'civicrm_pledge',
234 'entity' => 'Pledge',
235 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 236 'localizable' => 0,
c3fc2621
CW
237 ],
238 'pledge_contact_id' => [
e501603b
TO
239 'name' => 'contact_id',
240 'type' => CRM_Utils_Type::T_INT,
c3fc2621 241 'title' => ts('Contact ID'),
215b423e 242 'description' => ts('Foreign key to civicrm_contact.id .'),
c3fc2621
CW
243 'required' => TRUE,
244 'import' => TRUE,
e501603b 245 'where' => 'civicrm_pledge.contact_id',
c3fc2621 246 'export' => TRUE,
522a26c9 247 'table_name' => 'civicrm_pledge',
248 'entity' => 'Pledge',
249 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 250 'localizable' => 0,
e501603b 251 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621 252 'html' => [
e501603b 253 'type' => 'EntityRef',
c3fc2621
CW
254 ],
255 ],
256 'pledge_financial_type_id' => [
e501603b
TO
257 'name' => 'financial_type_id',
258 'type' => CRM_Utils_Type::T_INT,
c3fc2621 259 'title' => ts('Type'),
215b423e 260 'description' => ts('FK to Financial Type'),
a36434b9 261 'where' => 'civicrm_pledge.financial_type_id',
522a26c9 262 'table_name' => 'civicrm_pledge',
263 'entity' => 'Pledge',
264 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 265 'localizable' => 0,
e501603b 266 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 267 'html' => [
e501603b 268 'type' => 'Select',
c3fc2621
CW
269 ],
270 'pseudoconstant' => [
e501603b
TO
271 'table' => 'civicrm_financial_type',
272 'keyColumn' => 'id',
273 'labelColumn' => 'name',
c3fc2621
CW
274 ]
275 ],
276 'pledge_contribution_page_id' => [
e501603b
TO
277 'name' => 'contribution_page_id',
278 'type' => CRM_Utils_Type::T_INT,
c3fc2621 279 'title' => ts('Pledge Contribution Page'),
215b423e 280 'description' => ts('The Contribution Page which triggered this contribution'),
a36434b9 281 'where' => 'civicrm_pledge.contribution_page_id',
522a26c9 282 'table_name' => 'civicrm_pledge',
283 'entity' => 'Pledge',
284 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 285 'localizable' => 0,
e501603b 286 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
c3fc2621
CW
287 ],
288 'pledge_amount' => [
e501603b
TO
289 'name' => 'amount',
290 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 291 'title' => ts('Total Pledged'),
215b423e 292 'description' => ts('Total pledged amount.'),
c3fc2621
CW
293 'required' => TRUE,
294 'precision' => [
e501603b
TO
295 20,
296 2
c3fc2621
CW
297 ],
298 'import' => TRUE,
e501603b 299 'where' => 'civicrm_pledge.amount',
c3fc2621 300 'export' => TRUE,
522a26c9 301 'table_name' => 'civicrm_pledge',
302 'entity' => 'Pledge',
303 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 304 'localizable' => 0,
c3fc2621 305 'html' => [
e501603b 306 'type' => 'Text',
c3fc2621
CW
307 ],
308 ],
309 'pledge_original_installment_amount' => [
e501603b
TO
310 'name' => 'original_installment_amount',
311 'type' => CRM_Utils_Type::T_MONEY,
c3fc2621 312 'title' => ts('Original Installment Amount'),
215b423e 313 'description' => ts('Original amount for each of the installments.'),
c3fc2621
CW
314 'required' => TRUE,
315 'precision' => [
e501603b
TO
316 20,
317 2
c3fc2621 318 ],
db517dfe 319 'where' => 'civicrm_pledge.original_installment_amount',
a36434b9 320 'export' => TRUE,
522a26c9 321 'table_name' => 'civicrm_pledge',
322 'entity' => 'Pledge',
323 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 324 'localizable' => 0,
c3fc2621 325 'html' => [
e501603b 326 'type' => 'Text',
c3fc2621
CW
327 ],
328 ],
329 'currency' => [
e501603b
TO
330 'name' => 'currency',
331 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 332 'title' => ts('Pledge Currency'),
215b423e 333 'description' => ts('3 character string, value from config setting or input via user.'),
e501603b
TO
334 'maxlength' => 3,
335 'size' => CRM_Utils_Type::FOUR,
a36434b9 336 'where' => 'civicrm_pledge.currency',
e501603b 337 'default' => 'NULL',
522a26c9 338 'table_name' => 'civicrm_pledge',
339 'entity' => 'Pledge',
340 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 341 'localizable' => 0,
c3fc2621 342 'html' => [
e501603b 343 'type' => 'Select',
c3fc2621
CW
344 ],
345 'pseudoconstant' => [
e501603b
TO
346 'table' => 'civicrm_currency',
347 'keyColumn' => 'name',
348 'labelColumn' => 'full_name',
349 'nameColumn' => 'name',
c3fc2621
CW
350 ]
351 ],
352 'pledge_frequency_unit' => [
e501603b
TO
353 'name' => 'frequency_unit',
354 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 355 'title' => ts('Pledge Frequency Unit'),
215b423e 356 'description' => ts('Time units for recurrence of pledge payments.'),
e501603b
TO
357 'maxlength' => 8,
358 'size' => CRM_Utils_Type::EIGHT,
a36434b9 359 'where' => 'civicrm_pledge.frequency_unit',
e501603b 360 'default' => 'month',
522a26c9 361 'table_name' => 'civicrm_pledge',
362 'entity' => 'Pledge',
363 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 364 'localizable' => 0,
c3fc2621 365 'html' => [
e501603b 366 'type' => 'Select',
c3fc2621
CW
367 ],
368 'pseudoconstant' => [
e501603b
TO
369 'optionGroupName' => 'recur_frequency_units',
370 'keyColumn' => 'name',
371 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units',
c3fc2621
CW
372 ]
373 ],
374 'pledge_frequency_interval' => [
e501603b
TO
375 'name' => 'frequency_interval',
376 'type' => CRM_Utils_Type::T_INT,
c3fc2621 377 'title' => ts('Pledge Frequency Interval'),
215b423e 378 'description' => ts('Number of time units for recurrence of pledge payments.'),
c3fc2621 379 'required' => TRUE,
a36434b9 380 'where' => 'civicrm_pledge.frequency_interval',
e501603b 381 'default' => '1',
522a26c9 382 'table_name' => 'civicrm_pledge',
383 'entity' => 'Pledge',
384 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 385 'localizable' => 0,
c3fc2621 386 'html' => [
e501603b 387 'type' => 'Text',
c3fc2621
CW
388 ],
389 ],
390 'frequency_day' => [
e501603b
TO
391 'name' => 'frequency_day',
392 'type' => CRM_Utils_Type::T_INT,
c3fc2621 393 'title' => ts('Pledge day'),
215b423e 394 'description' => ts('Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.'),
c3fc2621 395 'required' => TRUE,
a36434b9 396 'where' => 'civicrm_pledge.frequency_day',
e501603b 397 'default' => '3',
522a26c9 398 'table_name' => 'civicrm_pledge',
399 'entity' => 'Pledge',
400 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 401 'localizable' => 0,
c3fc2621 402 'html' => [
e501603b 403 'type' => 'Select',
c3fc2621
CW
404 ],
405 ],
406 'installments' => [
e501603b
TO
407 'name' => 'installments',
408 'type' => CRM_Utils_Type::T_INT,
c3fc2621 409 'title' => ts('Pledge Number of Installments'),
215b423e 410 'description' => ts('Total number of payments to be made.'),
db517dfe 411 'where' => 'civicrm_pledge.installments',
a36434b9 412 'export' => TRUE,
e501603b 413 'default' => '1',
522a26c9 414 'table_name' => 'civicrm_pledge',
415 'entity' => 'Pledge',
416 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 417 'localizable' => 0,
c3fc2621 418 'html' => [
e501603b 419 'type' => 'Text',
c3fc2621
CW
420 ],
421 ],
422 'start_date' => [
e501603b
TO
423 'name' => 'start_date',
424 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 425 'title' => ts('Pledge Start Date'),
215b423e 426 'description' => ts('The date the first scheduled pledge occurs.'),
c3fc2621 427 'required' => TRUE,
a36434b9 428 'where' => 'civicrm_pledge.start_date',
522a26c9 429 'table_name' => 'civicrm_pledge',
430 'entity' => 'Pledge',
431 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 432 'localizable' => 0,
c3fc2621 433 'html' => [
e501603b 434 'type' => 'Select Date',
c3fc2621
CW
435 ],
436 ],
437 'pledge_create_date' => [
e501603b
TO
438 'name' => 'create_date',
439 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 440 'title' => ts('Pledge Made'),
215b423e 441 'description' => ts('When this pledge record was created.'),
c3fc2621
CW
442 'required' => TRUE,
443 'import' => TRUE,
e501603b 444 'where' => 'civicrm_pledge.create_date',
c3fc2621 445 'export' => TRUE,
522a26c9 446 'table_name' => 'civicrm_pledge',
447 'entity' => 'Pledge',
448 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 449 'localizable' => 0,
c3fc2621 450 'html' => [
e501603b 451 'type' => 'Select Date',
c3fc2621
CW
452 ],
453 ],
454 'acknowledge_date' => [
e501603b
TO
455 'name' => 'acknowledge_date',
456 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 457 'title' => ts('Pledge Acknowledged'),
215b423e 458 'description' => ts('When a pledge acknowledgement message was sent to the contributor.'),
a36434b9 459 'where' => 'civicrm_pledge.acknowledge_date',
522a26c9 460 'table_name' => 'civicrm_pledge',
461 'entity' => 'Pledge',
462 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 463 'localizable' => 0,
c3fc2621 464 'html' => [
e501603b 465 'type' => 'Select Date',
c3fc2621
CW
466 ],
467 ],
468 'modified_date' => [
e501603b
TO
469 'name' => 'modified_date',
470 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 471 'title' => ts('Pledge Modified Date'),
215b423e 472 'description' => ts('Last updated date for this pledge record.'),
a36434b9 473 'where' => 'civicrm_pledge.modified_date',
522a26c9 474 'table_name' => 'civicrm_pledge',
475 'entity' => 'Pledge',
476 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 477 'localizable' => 0,
c3fc2621
CW
478 ],
479 'cancel_date' => [
e501603b
TO
480 'name' => 'cancel_date',
481 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 482 'title' => ts('Pledge Cancelled Date'),
215b423e 483 'description' => ts('Date this pledge was cancelled by contributor.'),
a36434b9 484 'where' => 'civicrm_pledge.cancel_date',
522a26c9 485 'table_name' => 'civicrm_pledge',
486 'entity' => 'Pledge',
487 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 488 'localizable' => 0,
c3fc2621 489 'html' => [
e501603b 490 'type' => 'Select Date',
c3fc2621
CW
491 ],
492 ],
493 'end_date' => [
e501603b
TO
494 'name' => 'end_date',
495 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 496 'title' => ts('Pledge End Date'),
215b423e 497 'description' => ts('Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).'),
a36434b9 498 'where' => 'civicrm_pledge.end_date',
522a26c9 499 'table_name' => 'civicrm_pledge',
500 'entity' => 'Pledge',
501 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 502 'localizable' => 0,
c3fc2621 503 'html' => [
e501603b 504 'type' => 'Select Date',
c3fc2621
CW
505 ],
506 ],
507 'max_reminders' => [
e501603b
TO
508 'name' => 'max_reminders',
509 'type' => CRM_Utils_Type::T_INT,
c3fc2621 510 'title' => ts('Maximum Number of Reminders'),
215b423e 511 'description' => ts('The maximum number of payment reminders to send for any given payment.'),
a36434b9 512 'where' => 'civicrm_pledge.max_reminders',
e501603b 513 'default' => '1',
522a26c9 514 'table_name' => 'civicrm_pledge',
515 'entity' => 'Pledge',
516 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 517 'localizable' => 0,
c3fc2621 518 'html' => [
e501603b 519 'type' => 'Text',
c3fc2621
CW
520 ],
521 ],
522 'initial_reminder_day' => [
e501603b
TO
523 'name' => 'initial_reminder_day',
524 'type' => CRM_Utils_Type::T_INT,
c3fc2621 525 'title' => ts('Initial Reminder Day'),
215b423e 526 'description' => ts('Send initial reminder this many days prior to the payment due date.'),
a36434b9 527 'where' => 'civicrm_pledge.initial_reminder_day',
e501603b 528 'default' => '5',
522a26c9 529 'table_name' => 'civicrm_pledge',
530 'entity' => 'Pledge',
531 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 532 'localizable' => 0,
c3fc2621 533 'html' => [
e501603b 534 'type' => 'Select',
c3fc2621
CW
535 ],
536 ],
537 'additional_reminder_day' => [
e501603b
TO
538 'name' => 'additional_reminder_day',
539 'type' => CRM_Utils_Type::T_INT,
c3fc2621 540 'title' => ts('Additional Reminder Days'),
215b423e 541 'description' => ts('Send additional reminder this many days after last one sent, up to maximum number of reminders.'),
a36434b9 542 'where' => 'civicrm_pledge.additional_reminder_day',
e501603b 543 'default' => '5',
522a26c9 544 'table_name' => 'civicrm_pledge',
545 'entity' => 'Pledge',
546 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 547 'localizable' => 0,
c3fc2621 548 'html' => [
e501603b 549 'type' => 'Text',
c3fc2621
CW
550 ],
551 ],
552 'pledge_status_id' => [
e501603b
TO
553 'name' => 'status_id',
554 'type' => CRM_Utils_Type::T_INT,
c3fc2621 555 'title' => ts('Pledge Status Id'),
215b423e 556 'description' => ts('Implicit foreign key to civicrm_option_values in the pledge_status option group.'),
c3fc2621 557 'import' => TRUE,
e501603b 558 'where' => 'civicrm_pledge.status_id',
c3fc2621 559 'export' => FALSE,
522a26c9 560 'table_name' => 'civicrm_pledge',
561 'entity' => 'Pledge',
562 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 563 'localizable' => 0,
c3fc2621 564 'pseudoconstant' => [
01dac399
JP
565 'optionGroupName' => 'pledge_status',
566 'optionEditPath' => 'civicrm/admin/options/pledge_status',
c3fc2621
CW
567 ]
568 ],
569 'pledge_is_test' => [
e501603b
TO
570 'name' => 'is_test',
571 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621
CW
572 'title' => ts('Test'),
573 'import' => TRUE,
e501603b 574 'where' => 'civicrm_pledge.is_test',
c3fc2621 575 'export' => TRUE,
45a83e42 576 'default' => '0',
522a26c9 577 'table_name' => 'civicrm_pledge',
578 'entity' => 'Pledge',
579 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 580 'localizable' => 0,
c3fc2621 581 'html' => [
e501603b 582 'type' => 'CheckBox',
c3fc2621
CW
583 ],
584 ],
585 'pledge_campaign_id' => [
e501603b
TO
586 'name' => 'campaign_id',
587 'type' => CRM_Utils_Type::T_INT,
c3fc2621 588 'title' => ts('Campaign'),
215b423e 589 'description' => ts('The campaign for which this pledge has been initiated.'),
c3fc2621 590 'import' => TRUE,
e501603b 591 'where' => 'civicrm_pledge.campaign_id',
c3fc2621 592 'export' => TRUE,
522a26c9 593 'table_name' => 'civicrm_pledge',
594 'entity' => 'Pledge',
595 'bao' => 'CRM_Pledge_BAO_Pledge',
6a7e5e5d 596 'localizable' => 0,
e501603b 597 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
c3fc2621 598 'html' => [
e501603b 599 'type' => 'Select',
c3fc2621
CW
600 ],
601 'pseudoconstant' => [
e501603b
TO
602 'table' => 'civicrm_campaign',
603 'keyColumn' => 'id',
604 'labelColumn' => 'title',
c3fc2621
CW
605 ]
606 ],
607 ];
346aaaba 608 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 609 }
346aaaba 610 return Civi::$statics[__CLASS__]['fields'];
e501603b 611 }
c3fc2621 612
e501603b 613 /**
bd8e0b14 614 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
615 *
616 * @return array
bd8e0b14 617 * Array(string $name => string $uniqueName).
e501603b 618 */
c3fc2621 619 public static function &fieldKeys() {
bd8e0b14
TO
620 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
621 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 622 }
bd8e0b14 623 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 624 }
c3fc2621 625
e501603b
TO
626 /**
627 * Returns the names of this table
628 *
629 * @return string
630 */
c3fc2621 631 public static function getTableName() {
e501603b
TO
632 return self::$_tableName;
633 }
c3fc2621 634
e501603b
TO
635 /**
636 * Returns if this table needs to be logged
637 *
c3fc2621 638 * @return bool
e501603b 639 */
c3fc2621 640 public function getLog() {
e501603b
TO
641 return self::$_log;
642 }
c3fc2621 643
e501603b
TO
644 /**
645 * Returns the list of fields that can be imported
646 *
647 * @param bool $prefix
648 *
649 * @return array
650 */
c3fc2621
CW
651 public static function &import($prefix = FALSE) {
652 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pledge', $prefix, []);
60808919 653 return $r;
e501603b 654 }
c3fc2621 655
e501603b
TO
656 /**
657 * Returns the list of fields that can be exported
658 *
659 * @param bool $prefix
660 *
661 * @return array
662 */
c3fc2621
CW
663 public static function &export($prefix = FALSE) {
664 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pledge', $prefix, []);
60808919 665 return $r;
e501603b 666 }
c3fc2621 667
e7a6b91a
AS
668 /**
669 * Returns the list of indices
c3fc2621
CW
670 *
671 * @param bool $localize
672 *
673 * @return array
e7a6b91a
AS
674 */
675 public static function indices($localize = TRUE) {
c3fc2621
CW
676 $indices = [
677 'index_status' => [
e7a6b91a 678 'name' => 'index_status',
c3fc2621 679 'field' => [
e7a6b91a 680 0 => 'status_id',
c3fc2621
CW
681 ],
682 'localizable' => FALSE,
e7a6b91a 683 'sig' => 'civicrm_pledge::0::status_id',
c3fc2621
CW
684 ],
685 ];
e7a6b91a
AS
686 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
687 }
c3fc2621 688
e501603b 689}