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:8d427bd23082d6b6dbad3492e9f668ca)
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;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
51 * FK to contribution table.
53 * @var int|string|null
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
57 public $contribution_id;
60 * Pledged amount for this payment (the actual contribution amount might be different).
63 * (SQL type: decimal(20,2))
64 * Note that values will be retrieved from the database as a string.
66 public $scheduled_amount;
69 * Actual amount that is paid as the Pledged installment amount.
71 * @var float|string|null
72 * (SQL type: decimal(20,2))
73 * Note that values will be retrieved from the database as a string.
75 public $actual_amount;
78 * 3 character string, value from config setting or input via user.
81 * (SQL type: varchar(3))
82 * Note that values will be retrieved from the database as a string.
87 * The date the pledge payment is supposed to happen.
90 * (SQL type: datetime)
91 * Note that values will be retrieved from the database as a string.
93 public $scheduled_date;
96 * The date that the most recent payment reminder was sent.
99 * (SQL type: datetime)
100 * Note that values will be retrieved from the database as a string.
102 public $reminder_date;
105 * The number of payment reminders sent.
107 * @var int|string|null
108 * (SQL type: int unsigned)
109 * Note that values will be retrieved from the database as a string.
111 public $reminder_count;
114 * @var int|string|null
115 * (SQL type: int unsigned)
116 * Note that values will be retrieved from the database as a string.
123 public function __construct() {
124 $this->__table
= 'civicrm_pledge_payment';
125 parent
::__construct();
129 * Returns localized title of this entity.
131 * @param bool $plural
132 * Whether to return the plural version of the title.
134 public static function getEntityTitle($plural = FALSE) {
135 return $plural ?
ts('Pledge Payments') : ts('Pledge Payment');
139 * Returns foreign keys and entity references.
142 * [CRM_Core_Reference_Interface]
144 public static function getReferenceColumns() {
145 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
146 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
147 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'pledge_id', 'civicrm_pledge', 'id');
148 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
149 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
151 return Civi
::$statics[__CLASS__
]['links'];
155 * Returns all the column names of this table
159 public static function &fields() {
160 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
161 Civi
::$statics[__CLASS__
]['fields'] = [
162 'pledge_payment_id' => [
164 'type' => CRM_Utils_Type
::T_INT
,
165 'title' => ts('Payment ID'),
168 'where' => 'civicrm_pledge_payment.id',
170 'table_name' => 'civicrm_pledge_payment',
171 'entity' => 'PledgePayment',
172 'bao' => 'CRM_Pledge_BAO_PledgePayment',
181 'name' => 'pledge_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Pledge ID'),
184 'description' => ts('FK to Pledge table'),
186 'where' => 'civicrm_pledge_payment.pledge_id',
187 'table_name' => 'civicrm_pledge_payment',
188 'entity' => 'PledgePayment',
189 'bao' => 'CRM_Pledge_BAO_PledgePayment',
191 'FKClassName' => 'CRM_Pledge_DAO_Pledge',
193 'label' => ts("Pledge"),
197 'contribution_id' => [
198 'name' => 'contribution_id',
199 'type' => CRM_Utils_Type
::T_INT
,
200 'title' => ts('Contribution ID'),
201 'description' => ts('FK to contribution table.'),
202 'where' => 'civicrm_pledge_payment.contribution_id',
203 'table_name' => 'civicrm_pledge_payment',
204 'entity' => 'PledgePayment',
205 'bao' => 'CRM_Pledge_BAO_PledgePayment',
207 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
209 'label' => ts("Contribution"),
213 'pledge_payment_scheduled_amount' => [
214 'name' => 'scheduled_amount',
215 'type' => CRM_Utils_Type
::T_MONEY
,
216 'title' => ts('Scheduled Amount'),
217 'description' => ts('Pledged amount for this payment (the actual contribution amount might be different).'),
224 'where' => 'civicrm_pledge_payment.scheduled_amount',
226 'table_name' => 'civicrm_pledge_payment',
227 'entity' => 'PledgePayment',
228 'bao' => 'CRM_Pledge_BAO_PledgePayment',
232 'pledge_payment_actual_amount' => [
233 'name' => 'actual_amount',
234 'type' => CRM_Utils_Type
::T_MONEY
,
235 'title' => ts('Actual Amount'),
236 'description' => ts('Actual amount that is paid as the Pledged installment amount.'),
242 'where' => 'civicrm_pledge_payment.actual_amount',
244 'table_name' => 'civicrm_pledge_payment',
245 'entity' => 'PledgePayment',
246 'bao' => 'CRM_Pledge_BAO_PledgePayment',
251 'name' => 'currency',
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('Currency'),
254 'description' => ts('3 character string, value from config setting or input via user.'),
256 'size' => CRM_Utils_Type
::FOUR
,
257 'where' => 'civicrm_pledge_payment.currency',
259 'table_name' => 'civicrm_pledge_payment',
260 'entity' => 'PledgePayment',
261 'bao' => 'CRM_Pledge_BAO_PledgePayment',
266 'pseudoconstant' => [
267 'table' => 'civicrm_currency',
268 'keyColumn' => 'name',
269 'labelColumn' => 'full_name',
270 'nameColumn' => 'name',
271 'abbrColumn' => 'symbol',
275 'pledge_payment_scheduled_date' => [
276 'name' => 'scheduled_date',
277 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
278 'title' => ts('Scheduled Date'),
279 'description' => ts('The date the pledge payment is supposed to happen.'),
282 'where' => 'civicrm_pledge_payment.scheduled_date',
284 'table_name' => 'civicrm_pledge_payment',
285 'entity' => 'PledgePayment',
286 'bao' => 'CRM_Pledge_BAO_PledgePayment',
288 'unique_title' => ts('Payment Scheduled'),
290 'type' => 'Select Date',
291 'formatType' => 'activityDate',
295 'pledge_payment_reminder_date' => [
296 'name' => 'reminder_date',
297 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
298 'title' => ts('Last Reminder'),
299 'description' => ts('The date that the most recent payment reminder was sent.'),
301 'where' => 'civicrm_pledge_payment.reminder_date',
303 'table_name' => 'civicrm_pledge_payment',
304 'entity' => 'PledgePayment',
305 'bao' => 'CRM_Pledge_BAO_PledgePayment',
309 'pledge_payment_reminder_count' => [
310 'name' => 'reminder_count',
311 'type' => CRM_Utils_Type
::T_INT
,
312 'title' => ts('Reminders Sent'),
313 'description' => ts('The number of payment reminders sent.'),
315 'where' => 'civicrm_pledge_payment.reminder_count',
318 'table_name' => 'civicrm_pledge_payment',
319 'entity' => 'PledgePayment',
320 'bao' => 'CRM_Pledge_BAO_PledgePayment',
324 'pledge_payment_status_id' => [
325 'name' => 'status_id',
326 'type' => CRM_Utils_Type
::T_INT
,
327 'title' => ts('Payment Status'),
329 'where' => 'civicrm_pledge_payment.status_id',
331 'table_name' => 'civicrm_pledge_payment',
332 'entity' => 'PledgePayment',
333 'bao' => 'CRM_Pledge_BAO_PledgePayment',
335 'pseudoconstant' => [
336 'optionGroupName' => 'contribution_status',
337 'optionEditPath' => 'civicrm/admin/options/contribution_status',
342 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
344 return Civi
::$statics[__CLASS__
]['fields'];
348 * Return a mapping from field-name to the corresponding key (as used in fields()).
351 * Array(string $name => string $uniqueName).
353 public static function &fieldKeys() {
354 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
355 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
357 return Civi
::$statics[__CLASS__
]['fieldKeys'];
361 * Returns the names of this table
365 public static function getTableName() {
366 return self
::$_tableName;
370 * Returns if this table needs to be logged
374 public function getLog() {
379 * Returns the list of fields that can be imported
381 * @param bool $prefix
385 public static function &import($prefix = FALSE) {
386 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'pledge_payment', $prefix, []);
391 * Returns the list of fields that can be exported
393 * @param bool $prefix
397 public static function &export($prefix = FALSE) {
398 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'pledge_payment', $prefix, []);
403 * Returns the list of indices
405 * @param bool $localize
409 public static function indices($localize = TRUE) {
411 'index_contribution_pledge' => [
412 'name' => 'index_contribution_pledge',
414 0 => 'contribution_id',
417 'localizable' => FALSE,
418 'sig' => 'civicrm_pledge_payment::0::contribution_id::pledge_id',
421 'name' => 'index_status',
425 'localizable' => FALSE,
426 'sig' => 'civicrm_pledge_payment::0::status_id',
429 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;