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:b3b6719f4f4a8c441f271213ff7f52db)
13 * Database access object for the PledgePayment entity.
15 class CRM_Pledge_DAO_PledgePayment
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_pledge_payment';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
46 * FK to contribution table.
50 public $contribution_id;
53 * Pledged amount for this payment (the actual contribution amount might be different).
57 public $scheduled_amount;
60 * Actual amount that is paid as the Pledged installment amount.
64 public $actual_amount;
67 * 3 character string, value from config setting or input via user.
74 * The date the pledge payment is supposed to happen.
78 public $scheduled_date;
81 * The date that the most recent payment reminder was sent.
85 public $reminder_date;
88 * The number of payment reminders sent.
92 public $reminder_count;
102 public function __construct() {
103 $this->__table
= 'civicrm_pledge_payment';
104 parent
::__construct();
108 * Returns localized title of this entity.
110 * @param bool $plural
111 * Whether to return the plural version of the title.
113 public static function getEntityTitle($plural = FALSE) {
114 return $plural ?
ts('Pledge Payments') : ts('Pledge Payment');
118 * Returns foreign keys and entity references.
121 * [CRM_Core_Reference_Interface]
123 public static function getReferenceColumns() {
124 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
125 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
126 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'pledge_id', 'civicrm_pledge', 'id');
127 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
128 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
130 return Civi
::$statics[__CLASS__
]['links'];
134 * Returns all the column names of this table
138 public static function &fields() {
139 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
140 Civi
::$statics[__CLASS__
]['fields'] = [
141 'pledge_payment_id' => [
143 'type' => CRM_Utils_Type
::T_INT
,
144 'title' => ts('Payment ID'),
147 'where' => 'civicrm_pledge_payment.id',
149 'table_name' => 'civicrm_pledge_payment',
150 'entity' => 'PledgePayment',
151 'bao' => 'CRM_Pledge_BAO_PledgePayment',
156 'name' => 'pledge_id',
157 'type' => CRM_Utils_Type
::T_INT
,
158 'title' => ts('Pledge'),
159 'description' => ts('FK to Pledge table'),
161 'where' => 'civicrm_pledge_payment.pledge_id',
162 'table_name' => 'civicrm_pledge_payment',
163 'entity' => 'PledgePayment',
164 'bao' => 'CRM_Pledge_BAO_PledgePayment',
166 'FKClassName' => 'CRM_Pledge_DAO_Pledge',
169 'contribution_id' => [
170 'name' => 'contribution_id',
171 'type' => CRM_Utils_Type
::T_INT
,
172 'title' => ts('Contribution'),
173 'description' => ts('FK to contribution table.'),
174 'where' => 'civicrm_pledge_payment.contribution_id',
175 'table_name' => 'civicrm_pledge_payment',
176 'entity' => 'PledgePayment',
177 'bao' => 'CRM_Pledge_BAO_PledgePayment',
179 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
182 'pledge_payment_scheduled_amount' => [
183 'name' => 'scheduled_amount',
184 'type' => CRM_Utils_Type
::T_MONEY
,
185 'title' => ts('Scheduled Amount'),
186 'description' => ts('Pledged amount for this payment (the actual contribution amount might be different).'),
193 'where' => 'civicrm_pledge_payment.scheduled_amount',
195 'table_name' => 'civicrm_pledge_payment',
196 'entity' => 'PledgePayment',
197 'bao' => 'CRM_Pledge_BAO_PledgePayment',
201 'pledge_payment_actual_amount' => [
202 'name' => 'actual_amount',
203 'type' => CRM_Utils_Type
::T_MONEY
,
204 'title' => ts('Actual Amount'),
205 'description' => ts('Actual amount that is paid as the Pledged installment amount.'),
211 'where' => 'civicrm_pledge_payment.actual_amount',
213 'table_name' => 'civicrm_pledge_payment',
214 'entity' => 'PledgePayment',
215 'bao' => 'CRM_Pledge_BAO_PledgePayment',
220 'name' => 'currency',
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Currency'),
223 'description' => ts('3 character string, value from config setting or input via user.'),
225 'size' => CRM_Utils_Type
::FOUR
,
226 'where' => 'civicrm_pledge_payment.currency',
228 'table_name' => 'civicrm_pledge_payment',
229 'entity' => 'PledgePayment',
230 'bao' => 'CRM_Pledge_BAO_PledgePayment',
235 'pseudoconstant' => [
236 'table' => 'civicrm_currency',
237 'keyColumn' => 'name',
238 'labelColumn' => 'full_name',
239 'nameColumn' => 'name',
240 'abbrColumn' => 'symbol',
244 'pledge_payment_scheduled_date' => [
245 'name' => 'scheduled_date',
246 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
247 'title' => ts('Scheduled Date'),
248 'description' => ts('The date the pledge payment is supposed to happen.'),
251 'where' => 'civicrm_pledge_payment.scheduled_date',
253 'table_name' => 'civicrm_pledge_payment',
254 'entity' => 'PledgePayment',
255 'bao' => 'CRM_Pledge_BAO_PledgePayment',
257 'unique_title' => ts('Payment Scheduled'),
259 'type' => 'Select Date',
260 'formatType' => 'activityDate',
264 'pledge_payment_reminder_date' => [
265 'name' => 'reminder_date',
266 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
267 'title' => ts('Last Reminder'),
268 'description' => ts('The date that the most recent payment reminder was sent.'),
270 'where' => 'civicrm_pledge_payment.reminder_date',
272 'table_name' => 'civicrm_pledge_payment',
273 'entity' => 'PledgePayment',
274 'bao' => 'CRM_Pledge_BAO_PledgePayment',
278 'pledge_payment_reminder_count' => [
279 'name' => 'reminder_count',
280 'type' => CRM_Utils_Type
::T_INT
,
281 'title' => ts('Reminders Sent'),
282 'description' => ts('The number of payment reminders sent.'),
284 'where' => 'civicrm_pledge_payment.reminder_count',
287 'table_name' => 'civicrm_pledge_payment',
288 'entity' => 'PledgePayment',
289 'bao' => 'CRM_Pledge_BAO_PledgePayment',
293 'pledge_payment_status_id' => [
294 'name' => 'status_id',
295 'type' => CRM_Utils_Type
::T_INT
,
296 'title' => ts('Payment Status'),
298 'where' => 'civicrm_pledge_payment.status_id',
300 'table_name' => 'civicrm_pledge_payment',
301 'entity' => 'PledgePayment',
302 'bao' => 'CRM_Pledge_BAO_PledgePayment',
304 'pseudoconstant' => [
305 'optionGroupName' => 'contribution_status',
306 'optionEditPath' => 'civicrm/admin/options/contribution_status',
311 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
313 return Civi
::$statics[__CLASS__
]['fields'];
317 * Return a mapping from field-name to the corresponding key (as used in fields()).
320 * Array(string $name => string $uniqueName).
322 public static function &fieldKeys() {
323 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
324 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
326 return Civi
::$statics[__CLASS__
]['fieldKeys'];
330 * Returns the names of this table
334 public static function getTableName() {
335 return self
::$_tableName;
339 * Returns if this table needs to be logged
343 public function getLog() {
348 * Returns the list of fields that can be imported
350 * @param bool $prefix
354 public static function &import($prefix = FALSE) {
355 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pledge_payment', $prefix, []);
360 * Returns the list of fields that can be exported
362 * @param bool $prefix
366 public static function &export($prefix = FALSE) {
367 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pledge_payment', $prefix, []);
372 * Returns the list of indices
374 * @param bool $localize
378 public static function indices($localize = TRUE) {
380 'index_contribution_pledge' => [
381 'name' => 'index_contribution_pledge',
383 0 => 'contribution_id',
386 'localizable' => FALSE,
387 'sig' => 'civicrm_pledge_payment::0::contribution_id::pledge_id',
390 'name' => 'index_status',
394 'localizable' => FALSE,
395 'sig' => 'civicrm_pledge_payment::0::status_id',
398 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;