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:e9764dc46ae261f8cad8ef1383063d61)
13 * Database access object for the MembershipPayment entity.
15 class CRM_Member_DAO_MembershipPayment
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.5';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_membership_payment';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
39 * FK to Membership table
43 public $membership_id;
46 * FK to contribution table.
50 public $contribution_id;
55 public function __construct() {
56 $this->__table
= 'civicrm_membership_payment';
57 parent
::__construct();
61 * Returns localized title of this entity.
64 * Whether to return the plural version of the title.
66 public static function getEntityTitle($plural = FALSE) {
67 return $plural ?
ts('Membership Payments') : ts('Membership Payment');
71 * Returns foreign keys and entity references.
74 * [CRM_Core_Reference_Interface]
76 public static function getReferenceColumns() {
77 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
78 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
79 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_id', 'civicrm_membership', 'id');
80 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
81 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
83 return Civi
::$statics[__CLASS__
]['links'];
87 * Returns all the column names of this table
91 public static function &fields() {
92 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
93 Civi
::$statics[__CLASS__
]['fields'] = [
96 'type' => CRM_Utils_Type
::T_INT
,
97 'title' => ts('Membership Payment ID'),
99 'where' => 'civicrm_membership_payment.id',
100 'table_name' => 'civicrm_membership_payment',
101 'entity' => 'MembershipPayment',
102 'bao' => 'CRM_Member_BAO_MembershipPayment',
107 'name' => 'membership_id',
108 'type' => CRM_Utils_Type
::T_INT
,
109 'title' => ts('Membership'),
110 'description' => ts('FK to Membership table'),
112 'where' => 'civicrm_membership_payment.membership_id',
113 'table_name' => 'civicrm_membership_payment',
114 'entity' => 'MembershipPayment',
115 'bao' => 'CRM_Member_BAO_MembershipPayment',
117 'FKClassName' => 'CRM_Member_DAO_Membership',
120 'contribution_id' => [
121 'name' => 'contribution_id',
122 'type' => CRM_Utils_Type
::T_INT
,
123 'title' => ts('Contribution'),
124 'description' => ts('FK to contribution table.'),
125 'where' => 'civicrm_membership_payment.contribution_id',
126 'table_name' => 'civicrm_membership_payment',
127 'entity' => 'MembershipPayment',
128 'bao' => 'CRM_Member_BAO_MembershipPayment',
130 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
134 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
136 return Civi
::$statics[__CLASS__
]['fields'];
140 * Return a mapping from field-name to the corresponding key (as used in fields()).
143 * Array(string $name => string $uniqueName).
145 public static function &fieldKeys() {
146 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
147 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
149 return Civi
::$statics[__CLASS__
]['fieldKeys'];
153 * Returns the names of this table
157 public static function getTableName() {
158 return self
::$_tableName;
162 * Returns if this table needs to be logged
166 public function getLog() {
171 * Returns the list of fields that can be imported
173 * @param bool $prefix
177 public static function &import($prefix = FALSE) {
178 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_payment', $prefix, []);
183 * Returns the list of fields that can be exported
185 * @param bool $prefix
189 public static function &export($prefix = FALSE) {
190 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_payment', $prefix, []);
195 * Returns the list of indices
197 * @param bool $localize
201 public static function indices($localize = TRUE) {
203 'UI_contribution_membership' => [
204 'name' => 'UI_contribution_membership',
206 0 => 'contribution_id',
207 1 => 'membership_id',
209 'localizable' => FALSE,
211 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id',
214 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;