5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Pledge/PledgePayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:64c6aef9e06ba7320d917ec5515c5ffc)
13 * Database access object for the PledgePayment entity.
15 class CRM_Pledge_DAO_PledgePayment
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_pledge_payment';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
44 * FK to contribution table.
48 public $contribution_id;
51 * Pledged amount for this payment (the actual contribution amount might be different).
55 public $scheduled_amount;
58 * Actual amount that is paid as the Pledged installment amount.
62 public $actual_amount;
65 * 3 character string, value from config setting or input via user.
72 * The date the pledge payment is supposed to happen.
76 public $scheduled_date;
79 * The date that the most recent payment reminder was sent.
83 public $reminder_date;
86 * The number of payment reminders sent.
90 public $reminder_count;
100 public function __construct() {
101 $this->__table
= 'civicrm_pledge_payment';
102 parent
::__construct();
106 * Returns localized title of this entity.
108 public static function getEntityTitle() {
109 return ts('Pledge Payments');
113 * Returns foreign keys and entity references.
116 * [CRM_Core_Reference_Interface]
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']);
125 return Civi
::$statics[__CLASS__
]['links'];
129 * Returns all the column names of this table
133 public static function &fields() {
134 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
135 Civi
::$statics[__CLASS__
]['fields'] = [
136 'pledge_payment_id' => [
138 'type' => CRM_Utils_Type
::T_INT
,
139 'title' => ts('Payment ID'),
142 'where' => 'civicrm_pledge_payment.id',
144 'table_name' => 'civicrm_pledge_payment',
145 'entity' => 'PledgePayment',
146 'bao' => 'CRM_Pledge_BAO_PledgePayment',
151 'name' => 'pledge_id',
152 'type' => CRM_Utils_Type
::T_INT
,
153 'title' => ts('Pledge'),
154 'description' => ts('FK to Pledge table'),
156 'where' => 'civicrm_pledge_payment.pledge_id',
157 'table_name' => 'civicrm_pledge_payment',
158 'entity' => 'PledgePayment',
159 'bao' => 'CRM_Pledge_BAO_PledgePayment',
161 'FKClassName' => 'CRM_Pledge_DAO_Pledge',
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',
174 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
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).'),
188 'where' => 'civicrm_pledge_payment.scheduled_amount',
190 'table_name' => 'civicrm_pledge_payment',
191 'entity' => 'PledgePayment',
192 'bao' => 'CRM_Pledge_BAO_PledgePayment',
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.'),
206 'where' => 'civicrm_pledge_payment.actual_amount',
208 'table_name' => 'civicrm_pledge_payment',
209 'entity' => 'PledgePayment',
210 'bao' => 'CRM_Pledge_BAO_PledgePayment',
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.'),
220 'size' => CRM_Utils_Type
::FOUR
,
221 'where' => 'civicrm_pledge_payment.currency',
223 'table_name' => 'civicrm_pledge_payment',
224 'entity' => 'PledgePayment',
225 'bao' => 'CRM_Pledge_BAO_PledgePayment',
230 'pseudoconstant' => [
231 'table' => 'civicrm_currency',
232 'keyColumn' => 'name',
233 'labelColumn' => 'full_name',
234 'nameColumn' => 'name',
235 'abbrColumn' => 'symbol',
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.'),
246 'where' => 'civicrm_pledge_payment.scheduled_date',
248 'table_name' => 'civicrm_pledge_payment',
249 'entity' => 'PledgePayment',
250 'bao' => 'CRM_Pledge_BAO_PledgePayment',
252 'unique_title' => ts('Payment Scheduled'),
254 'type' => 'Select Date',
255 'formatType' => 'activityDate',
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.'),
265 'where' => 'civicrm_pledge_payment.reminder_date',
267 'table_name' => 'civicrm_pledge_payment',
268 'entity' => 'PledgePayment',
269 'bao' => 'CRM_Pledge_BAO_PledgePayment',
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.'),
279 'where' => 'civicrm_pledge_payment.reminder_count',
282 'table_name' => 'civicrm_pledge_payment',
283 'entity' => 'PledgePayment',
284 'bao' => 'CRM_Pledge_BAO_PledgePayment',
288 'pledge_payment_status_id' => [
289 'name' => 'status_id',
290 'type' => CRM_Utils_Type
::T_INT
,
291 'title' => ts('Payment Status'),
293 'where' => 'civicrm_pledge_payment.status_id',
295 'table_name' => 'civicrm_pledge_payment',
296 'entity' => 'PledgePayment',
297 'bao' => 'CRM_Pledge_BAO_PledgePayment',
299 'pseudoconstant' => [
300 'optionGroupName' => 'contribution_status',
301 'optionEditPath' => 'civicrm/admin/options/contribution_status',
306 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
308 return Civi
::$statics[__CLASS__
]['fields'];
312 * Return a mapping from field-name to the corresponding key (as used in fields()).
315 * Array(string $name => string $uniqueName).
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()));
321 return Civi
::$statics[__CLASS__
]['fieldKeys'];
325 * Returns the names of this table
329 public static function getTableName() {
330 return self
::$_tableName;
334 * Returns if this table needs to be logged
338 public function getLog() {
343 * Returns the list of fields that can be imported
345 * @param bool $prefix
349 public static function &import($prefix = FALSE) {
350 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pledge_payment', $prefix, []);
355 * Returns the list of fields that can be exported
357 * @param bool $prefix
361 public static function &export($prefix = FALSE) {
362 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pledge_payment', $prefix, []);
367 * Returns the list of indices
369 * @param bool $localize
373 public static function indices($localize = TRUE) {
375 'index_contribution_pledge' => [
376 'name' => 'index_contribution_pledge',
378 0 => 'contribution_id',
381 'localizable' => FALSE,
382 'sig' => 'civicrm_pledge_payment::0::contribution_id::pledge_id',
385 'name' => 'index_status',
389 'localizable' => FALSE,
390 'sig' => 'civicrm_pledge_payment::0::status_id',
393 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;