5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Pledge/PledgePayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:79875dd118415179172c3ac425758b29)
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 foreign keys and entity references.
109 * [CRM_Core_Reference_Interface]
111 public static function getReferenceColumns() {
112 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
113 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
114 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'pledge_id', 'civicrm_pledge', 'id');
115 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
116 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
118 return Civi
::$statics[__CLASS__
]['links'];
122 * Returns all the column names of this table
126 public static function &fields() {
127 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
128 Civi
::$statics[__CLASS__
]['fields'] = [
129 'pledge_payment_id' => [
131 'type' => CRM_Utils_Type
::T_INT
,
132 'title' => ts('Payment ID'),
135 'where' => 'civicrm_pledge_payment.id',
137 'table_name' => 'civicrm_pledge_payment',
138 'entity' => 'PledgePayment',
139 'bao' => 'CRM_Pledge_BAO_PledgePayment',
143 'name' => 'pledge_id',
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('Pledge'),
146 'description' => ts('FK to Pledge table'),
148 'where' => 'civicrm_pledge_payment.pledge_id',
149 'table_name' => 'civicrm_pledge_payment',
150 'entity' => 'PledgePayment',
151 'bao' => 'CRM_Pledge_BAO_PledgePayment',
153 'FKClassName' => 'CRM_Pledge_DAO_Pledge',
155 'contribution_id' => [
156 'name' => 'contribution_id',
157 'type' => CRM_Utils_Type
::T_INT
,
158 'title' => ts('Contribution'),
159 'description' => ts('FK to contribution table.'),
160 'where' => 'civicrm_pledge_payment.contribution_id',
161 'table_name' => 'civicrm_pledge_payment',
162 'entity' => 'PledgePayment',
163 'bao' => 'CRM_Pledge_BAO_PledgePayment',
165 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
167 'pledge_payment_scheduled_amount' => [
168 'name' => 'scheduled_amount',
169 'type' => CRM_Utils_Type
::T_MONEY
,
170 'title' => ts('Scheduled Amount'),
171 'description' => ts('Pledged amount for this payment (the actual contribution amount might be different).'),
178 'where' => 'civicrm_pledge_payment.scheduled_amount',
180 'table_name' => 'civicrm_pledge_payment',
181 'entity' => 'PledgePayment',
182 'bao' => 'CRM_Pledge_BAO_PledgePayment',
185 'pledge_payment_actual_amount' => [
186 'name' => 'actual_amount',
187 'type' => CRM_Utils_Type
::T_MONEY
,
188 'title' => ts('Actual Amount'),
189 'description' => ts('Actual amount that is paid as the Pledged installment amount.'),
195 'where' => 'civicrm_pledge_payment.actual_amount',
197 'table_name' => 'civicrm_pledge_payment',
198 'entity' => 'PledgePayment',
199 'bao' => 'CRM_Pledge_BAO_PledgePayment',
203 'name' => 'currency',
204 'type' => CRM_Utils_Type
::T_STRING
,
205 'title' => ts('Currency'),
206 'description' => ts('3 character string, value from config setting or input via user.'),
208 'size' => CRM_Utils_Type
::FOUR
,
209 'where' => 'civicrm_pledge_payment.currency',
211 'table_name' => 'civicrm_pledge_payment',
212 'entity' => 'PledgePayment',
213 'bao' => 'CRM_Pledge_BAO_PledgePayment',
218 'pseudoconstant' => [
219 'table' => 'civicrm_currency',
220 'keyColumn' => 'name',
221 'labelColumn' => 'full_name',
222 'nameColumn' => 'name',
225 'pledge_payment_scheduled_date' => [
226 'name' => 'scheduled_date',
227 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
228 'title' => ts('Scheduled Date'),
229 'description' => ts('The date the pledge payment is supposed to happen.'),
232 'where' => 'civicrm_pledge_payment.scheduled_date',
234 'table_name' => 'civicrm_pledge_payment',
235 'entity' => 'PledgePayment',
236 'bao' => 'CRM_Pledge_BAO_PledgePayment',
239 'type' => 'Select Date',
240 'formatType' => 'activityDate',
243 'pledge_payment_reminder_date' => [
244 'name' => 'reminder_date',
245 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
246 'title' => ts('Last Reminder'),
247 'description' => ts('The date that the most recent payment reminder was sent.'),
249 'where' => 'civicrm_pledge_payment.reminder_date',
251 'table_name' => 'civicrm_pledge_payment',
252 'entity' => 'PledgePayment',
253 'bao' => 'CRM_Pledge_BAO_PledgePayment',
256 'pledge_payment_reminder_count' => [
257 'name' => 'reminder_count',
258 'type' => CRM_Utils_Type
::T_INT
,
259 'title' => ts('Reminders Sent'),
260 'description' => ts('The number of payment reminders sent.'),
262 'where' => 'civicrm_pledge_payment.reminder_count',
265 'table_name' => 'civicrm_pledge_payment',
266 'entity' => 'PledgePayment',
267 'bao' => 'CRM_Pledge_BAO_PledgePayment',
270 'pledge_payment_status_id' => [
271 'name' => 'status_id',
272 'type' => CRM_Utils_Type
::T_INT
,
273 'title' => ts('Payment Status'),
275 'where' => 'civicrm_pledge_payment.status_id',
277 'table_name' => 'civicrm_pledge_payment',
278 'entity' => 'PledgePayment',
279 'bao' => 'CRM_Pledge_BAO_PledgePayment',
281 'pseudoconstant' => [
282 'optionGroupName' => 'contribution_status',
283 'optionEditPath' => 'civicrm/admin/options/contribution_status',
287 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
289 return Civi
::$statics[__CLASS__
]['fields'];
293 * Return a mapping from field-name to the corresponding key (as used in fields()).
296 * Array(string $name => string $uniqueName).
298 public static function &fieldKeys() {
299 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
300 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
302 return Civi
::$statics[__CLASS__
]['fieldKeys'];
306 * Returns the names of this table
310 public static function getTableName() {
311 return self
::$_tableName;
315 * Returns if this table needs to be logged
319 public function getLog() {
324 * Returns the list of fields that can be imported
326 * @param bool $prefix
330 public static function &import($prefix = FALSE) {
331 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pledge_payment', $prefix, []);
336 * Returns the list of fields that can be exported
338 * @param bool $prefix
342 public static function &export($prefix = FALSE) {
343 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pledge_payment', $prefix, []);
348 * Returns the list of indices
350 * @param bool $localize
354 public static function indices($localize = TRUE) {
356 'index_contribution_pledge' => [
357 'name' => 'index_contribution_pledge',
359 0 => 'contribution_id',
362 'localizable' => FALSE,
363 'sig' => 'civicrm_pledge_payment::0::contribution_id::pledge_id',
366 'name' => 'index_status',
370 'localizable' => FALSE,
371 'sig' => 'civicrm_pledge_payment::0::status_id',
374 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;