5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Member/MembershipPayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f5961822475bf3b83377d72f9ed34b07)
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 static $_tableName = 'civicrm_membership_payment';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 'table_name' => 'civicrm_membership_payment',
88 'entity' => 'MembershipPayment',
89 'bao' => 'CRM_Member_BAO_MembershipPayment',
93 'name' => 'membership_id',
94 'type' => CRM_Utils_Type
::T_INT
,
95 'title' => ts('Membership'),
96 'description' => 'FK to Membership table',
98 'table_name' => 'civicrm_membership_payment',
99 'entity' => 'MembershipPayment',
100 'bao' => 'CRM_Member_BAO_MembershipPayment',
102 'FKClassName' => 'CRM_Member_DAO_Membership',
104 'contribution_id' => [
105 'name' => 'contribution_id',
106 'type' => CRM_Utils_Type
::T_INT
,
107 'title' => ts('Contribution'),
108 'description' => 'FK to contribution table.',
109 'table_name' => 'civicrm_membership_payment',
110 'entity' => 'MembershipPayment',
111 'bao' => 'CRM_Member_BAO_MembershipPayment',
113 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
116 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
118 return Civi
::$statics[__CLASS__
]['fields'];
122 * Return a mapping from field-name to the corresponding key (as used in fields()).
125 * Array(string $name => string $uniqueName).
127 public static function &fieldKeys() {
128 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
129 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
131 return Civi
::$statics[__CLASS__
]['fieldKeys'];
135 * Returns the names of this table
139 public static function getTableName() {
140 return self
::$_tableName;
144 * Returns if this table needs to be logged
148 public function getLog() {
153 * Returns the list of fields that can be imported
155 * @param bool $prefix
159 public static function &import($prefix = FALSE) {
160 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_payment', $prefix, []);
165 * Returns the list of fields that can be exported
167 * @param bool $prefix
171 public static function &export($prefix = FALSE) {
172 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_payment', $prefix, []);
177 * Returns the list of indices
179 * @param bool $localize
183 public static function indices($localize = TRUE) {
185 'UI_contribution_membership' => [
186 'name' => 'UI_contribution_membership',
188 0 => 'contribution_id',
189 1 => 'membership_id',
191 'localizable' => FALSE,
193 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id',
196 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;