5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Member/MembershipPayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b2fa8ca60001d75a9049ca179c4e68ce)
13 * Database access object for the MembershipPayment entity.
15 class CRM_Member_DAO_MembershipPayment
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_membership_payment';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
37 * FK to Membership table
41 public $membership_id;
44 * FK to contribution table.
48 public $contribution_id;
53 public function __construct() {
54 $this->__table
= 'civicrm_membership_payment';
55 parent
::__construct();
59 * Returns localized title of this entity.
61 public static function getEntityTitle() {
62 return ts('Membership Payments');
66 * Returns foreign keys and entity references.
69 * [CRM_Core_Reference_Interface]
71 public static function getReferenceColumns() {
72 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
73 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
74 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_id', 'civicrm_membership', 'id');
75 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
76 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
78 return Civi
::$statics[__CLASS__
]['links'];
82 * Returns all the column names of this table
86 public static function &fields() {
87 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
88 Civi
::$statics[__CLASS__
]['fields'] = [
91 'type' => CRM_Utils_Type
::T_INT
,
92 'title' => ts('Membership Payment ID'),
94 'where' => 'civicrm_membership_payment.id',
95 'table_name' => 'civicrm_membership_payment',
96 'entity' => 'MembershipPayment',
97 'bao' => 'CRM_Member_BAO_MembershipPayment',
102 'name' => 'membership_id',
103 'type' => CRM_Utils_Type
::T_INT
,
104 'title' => ts('Membership'),
105 'description' => ts('FK to Membership table'),
107 'where' => 'civicrm_membership_payment.membership_id',
108 'table_name' => 'civicrm_membership_payment',
109 'entity' => 'MembershipPayment',
110 'bao' => 'CRM_Member_BAO_MembershipPayment',
112 'FKClassName' => 'CRM_Member_DAO_Membership',
115 'contribution_id' => [
116 'name' => 'contribution_id',
117 'type' => CRM_Utils_Type
::T_INT
,
118 'title' => ts('Contribution'),
119 'description' => ts('FK to contribution table.'),
120 'where' => 'civicrm_membership_payment.contribution_id',
121 'table_name' => 'civicrm_membership_payment',
122 'entity' => 'MembershipPayment',
123 'bao' => 'CRM_Member_BAO_MembershipPayment',
125 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
129 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
131 return Civi
::$statics[__CLASS__
]['fields'];
135 * Return a mapping from field-name to the corresponding key (as used in fields()).
138 * Array(string $name => string $uniqueName).
140 public static function &fieldKeys() {
141 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
142 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
144 return Civi
::$statics[__CLASS__
]['fieldKeys'];
148 * Returns the names of this table
152 public static function getTableName() {
153 return self
::$_tableName;
157 * Returns if this table needs to be logged
161 public function getLog() {
166 * Returns the list of fields that can be imported
168 * @param bool $prefix
172 public static function &import($prefix = FALSE) {
173 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_payment', $prefix, []);
178 * Returns the list of fields that can be exported
180 * @param bool $prefix
184 public static function &export($prefix = FALSE) {
185 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_payment', $prefix, []);
190 * Returns the list of indices
192 * @param bool $localize
196 public static function indices($localize = TRUE) {
198 'UI_contribution_membership' => [
199 'name' => 'UI_contribution_membership',
201 0 => 'contribution_id',
202 1 => 'membership_id',
204 'localizable' => FALSE,
206 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id',
209 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;