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:bfa7183802af9f28111c1d7c7dc6af5a)
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';
18 const COMPONENT
= 'CiviPledge';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_pledge_payment';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
47 * FK to contribution table.
51 public $contribution_id;
54 * Pledged amount for this payment (the actual contribution amount might be different).
58 public $scheduled_amount;
61 * Actual amount that is paid as the Pledged installment amount.
65 public $actual_amount;
68 * 3 character string, value from config setting or input via user.
75 * The date the pledge payment is supposed to happen.
79 public $scheduled_date;
82 * The date that the most recent payment reminder was sent.
86 public $reminder_date;
89 * The number of payment reminders sent.
93 public $reminder_count;
103 public function __construct() {
104 $this->__table
= 'civicrm_pledge_payment';
105 parent
::__construct();
109 * Returns localized title of this entity.
111 * @param bool $plural
112 * Whether to return the plural version of the title.
114 public static function getEntityTitle($plural = FALSE) {
115 return $plural ?
ts('Pledge Payments') : ts('Pledge Payment');
119 * Returns foreign keys and entity references.
122 * [CRM_Core_Reference_Interface]
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']);
131 return Civi
::$statics[__CLASS__
]['links'];
135 * Returns all the column names of this table
139 public static function &fields() {
140 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
141 Civi
::$statics[__CLASS__
]['fields'] = [
142 'pledge_payment_id' => [
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('Payment ID'),
148 'where' => 'civicrm_pledge_payment.id',
150 'table_name' => 'civicrm_pledge_payment',
151 'entity' => 'PledgePayment',
152 'bao' => 'CRM_Pledge_BAO_PledgePayment',
161 'name' => 'pledge_id',
162 'type' => CRM_Utils_Type
::T_INT
,
163 'title' => ts('Pledge ID'),
164 'description' => ts('FK to Pledge table'),
166 'where' => 'civicrm_pledge_payment.pledge_id',
167 'table_name' => 'civicrm_pledge_payment',
168 'entity' => 'PledgePayment',
169 'bao' => 'CRM_Pledge_BAO_PledgePayment',
171 'FKClassName' => 'CRM_Pledge_DAO_Pledge',
173 'label' => ts("Pledge"),
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',
187 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
189 'label' => ts("Contribution"),
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).'),
204 'where' => 'civicrm_pledge_payment.scheduled_amount',
206 'table_name' => 'civicrm_pledge_payment',
207 'entity' => 'PledgePayment',
208 'bao' => 'CRM_Pledge_BAO_PledgePayment',
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.'),
222 'where' => 'civicrm_pledge_payment.actual_amount',
224 'table_name' => 'civicrm_pledge_payment',
225 'entity' => 'PledgePayment',
226 'bao' => 'CRM_Pledge_BAO_PledgePayment',
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.'),
236 'size' => CRM_Utils_Type
::FOUR
,
237 'where' => 'civicrm_pledge_payment.currency',
239 'table_name' => 'civicrm_pledge_payment',
240 'entity' => 'PledgePayment',
241 'bao' => 'CRM_Pledge_BAO_PledgePayment',
246 'pseudoconstant' => [
247 'table' => 'civicrm_currency',
248 'keyColumn' => 'name',
249 'labelColumn' => 'full_name',
250 'nameColumn' => 'name',
251 'abbrColumn' => 'symbol',
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.'),
262 'where' => 'civicrm_pledge_payment.scheduled_date',
264 'table_name' => 'civicrm_pledge_payment',
265 'entity' => 'PledgePayment',
266 'bao' => 'CRM_Pledge_BAO_PledgePayment',
268 'unique_title' => ts('Payment Scheduled'),
270 'type' => 'Select Date',
271 'formatType' => 'activityDate',
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.'),
281 'where' => 'civicrm_pledge_payment.reminder_date',
283 'table_name' => 'civicrm_pledge_payment',
284 'entity' => 'PledgePayment',
285 'bao' => 'CRM_Pledge_BAO_PledgePayment',
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.'),
295 'where' => 'civicrm_pledge_payment.reminder_count',
298 'table_name' => 'civicrm_pledge_payment',
299 'entity' => 'PledgePayment',
300 'bao' => 'CRM_Pledge_BAO_PledgePayment',
304 'pledge_payment_status_id' => [
305 'name' => 'status_id',
306 'type' => CRM_Utils_Type
::T_INT
,
307 'title' => ts('Payment Status'),
309 'where' => 'civicrm_pledge_payment.status_id',
311 'table_name' => 'civicrm_pledge_payment',
312 'entity' => 'PledgePayment',
313 'bao' => 'CRM_Pledge_BAO_PledgePayment',
315 'pseudoconstant' => [
316 'optionGroupName' => 'contribution_status',
317 'optionEditPath' => 'civicrm/admin/options/contribution_status',
322 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
324 return Civi
::$statics[__CLASS__
]['fields'];
328 * Return a mapping from field-name to the corresponding key (as used in fields()).
331 * Array(string $name => string $uniqueName).
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()));
337 return Civi
::$statics[__CLASS__
]['fieldKeys'];
341 * Returns the names of this table
345 public static function getTableName() {
346 return self
::$_tableName;
350 * Returns if this table needs to be logged
354 public function getLog() {
359 * Returns the list of fields that can be imported
361 * @param bool $prefix
365 public static function &import($prefix = FALSE) {
366 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pledge_payment', $prefix, []);
371 * Returns the list of fields that can be exported
373 * @param bool $prefix
377 public static function &export($prefix = FALSE) {
378 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pledge_payment', $prefix, []);
383 * Returns the list of indices
385 * @param bool $localize
389 public static function indices($localize = TRUE) {
391 'index_contribution_pledge' => [
392 'name' => 'index_contribution_pledge',
394 0 => 'contribution_id',
397 'localizable' => FALSE,
398 'sig' => 'civicrm_pledge_payment::0::contribution_id::pledge_id',
401 'name' => 'index_status',
405 'localizable' => FALSE,
406 'sig' => 'civicrm_pledge_payment::0::status_id',
409 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;