5 * @copyright CiviCRM LLC (c) 2004-2020
7 * Generated from xml/schema/CRM/Member/MembershipPayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:63ca9fcae0a4e6bffb8423ccdf019cdc)
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 foreign keys and entity references.
62 * [CRM_Core_Reference_Interface]
64 public static function getReferenceColumns() {
65 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
66 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
67 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_id', 'civicrm_membership', 'id');
68 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contribution_id', 'civicrm_contribution', 'id');
69 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
71 return Civi
::$statics[__CLASS__
]['links'];
75 * Returns all the column names of this table
79 public static function &fields() {
80 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
81 Civi
::$statics[__CLASS__
]['fields'] = [
84 'type' => CRM_Utils_Type
::T_INT
,
85 'title' => ts('Membership Payment ID'),
87 'where' => 'civicrm_membership_payment.id',
88 'table_name' => 'civicrm_membership_payment',
89 'entity' => 'MembershipPayment',
90 'bao' => 'CRM_Member_BAO_MembershipPayment',
94 'name' => 'membership_id',
95 'type' => CRM_Utils_Type
::T_INT
,
96 'title' => ts('Membership'),
97 'description' => ts('FK to Membership table'),
99 'where' => 'civicrm_membership_payment.membership_id',
100 'table_name' => 'civicrm_membership_payment',
101 'entity' => 'MembershipPayment',
102 'bao' => 'CRM_Member_BAO_MembershipPayment',
104 'FKClassName' => 'CRM_Member_DAO_Membership',
106 'contribution_id' => [
107 'name' => 'contribution_id',
108 'type' => CRM_Utils_Type
::T_INT
,
109 'title' => ts('Contribution'),
110 'description' => ts('FK to contribution table.'),
111 'where' => 'civicrm_membership_payment.contribution_id',
112 'table_name' => 'civicrm_membership_payment',
113 'entity' => 'MembershipPayment',
114 'bao' => 'CRM_Member_BAO_MembershipPayment',
116 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
119 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
121 return Civi
::$statics[__CLASS__
]['fields'];
125 * Return a mapping from field-name to the corresponding key (as used in fields()).
128 * Array(string $name => string $uniqueName).
130 public static function &fieldKeys() {
131 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
132 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
134 return Civi
::$statics[__CLASS__
]['fieldKeys'];
138 * Returns the names of this table
142 public static function getTableName() {
143 return self
::$_tableName;
147 * Returns if this table needs to be logged
151 public function getLog() {
156 * Returns the list of fields that can be imported
158 * @param bool $prefix
162 public static function &import($prefix = FALSE) {
163 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_payment', $prefix, []);
168 * Returns the list of fields that can be exported
170 * @param bool $prefix
174 public static function &export($prefix = FALSE) {
175 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_payment', $prefix, []);
180 * Returns the list of indices
182 * @param bool $localize
186 public static function indices($localize = TRUE) {
188 'UI_contribution_membership' => [
189 'name' => 'UI_contribution_membership',
191 0 => 'contribution_id',
192 1 => 'membership_id',
194 'localizable' => FALSE,
196 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id',
199 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;