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