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:a1d90b50f82493fea93ba2236877fb45)
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',
101 'name' => 'membership_id',
102 'type' => CRM_Utils_Type
::T_INT
,
103 'title' => ts('Membership'),
104 'description' => ts('FK to Membership table'),
106 'where' => 'civicrm_membership_payment.membership_id',
107 'table_name' => 'civicrm_membership_payment',
108 'entity' => 'MembershipPayment',
109 'bao' => 'CRM_Member_BAO_MembershipPayment',
111 'FKClassName' => 'CRM_Member_DAO_Membership',
113 'contribution_id' => [
114 'name' => 'contribution_id',
115 'type' => CRM_Utils_Type
::T_INT
,
116 'title' => ts('Contribution'),
117 'description' => ts('FK to contribution table.'),
118 'where' => 'civicrm_membership_payment.contribution_id',
119 'table_name' => 'civicrm_membership_payment',
120 'entity' => 'MembershipPayment',
121 'bao' => 'CRM_Member_BAO_MembershipPayment',
123 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
126 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
128 return Civi
::$statics[__CLASS__
]['fields'];
132 * Return a mapping from field-name to the corresponding key (as used in fields()).
135 * Array(string $name => string $uniqueName).
137 public static function &fieldKeys() {
138 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
139 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
141 return Civi
::$statics[__CLASS__
]['fieldKeys'];
145 * Returns the names of this table
149 public static function getTableName() {
150 return self
::$_tableName;
154 * Returns if this table needs to be logged
158 public function getLog() {
163 * Returns the list of fields that can be imported
165 * @param bool $prefix
169 public static function &import($prefix = FALSE) {
170 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_payment', $prefix, []);
175 * Returns the list of fields that can be exported
177 * @param bool $prefix
181 public static function &export($prefix = FALSE) {
182 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_payment', $prefix, []);
187 * Returns the list of indices
189 * @param bool $localize
193 public static function indices($localize = TRUE) {
195 'UI_contribution_membership' => [
196 'name' => 'UI_contribution_membership',
198 0 => 'contribution_id',
199 1 => 'membership_id',
201 'localizable' => FALSE,
203 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id',
206 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;