Merge branch '5.11' of https://github.com/civicrm/civicrm-core
[civicrm-core.git] / CRM / Member / DAO / MembershipPayment.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Member/MembershipPayment.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:1296687b8bc4acb0b1db07fdd131d7ea)
10 */
11
12 /**
13 * Database access object for the MembershipPayment entity.
14 */
15 class CRM_Member_DAO_MembershipPayment extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_membership_payment';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = TRUE;
30
31 /**
32 * @var int unsigned
33 */
34 public $id;
35
36 /**
37 * FK to Membership table
38 *
39 * @var int unsigned
40 */
41 public $membership_id;
42
43 /**
44 * FK to contribution table.
45 *
46 * @var int unsigned
47 */
48 public $contribution_id;
49
50 /**
51 * Class constructor.
52 */
53 public function __construct() {
54 $this->__table = 'civicrm_membership_payment';
55 parent::__construct();
56 }
57
58 /**
59 * Returns foreign keys and entity references.
60 *
61 * @return array
62 * [CRM_Core_Reference_Interface]
63 */
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']);
70 }
71 return Civi::$statics[__CLASS__]['links'];
72 }
73
74 /**
75 * Returns all the column names of this table
76 *
77 * @return array
78 */
79 public static function &fields() {
80 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
81 Civi::$statics[__CLASS__]['fields'] = [
82 'id' => [
83 'name' => 'id',
84 'type' => CRM_Utils_Type::T_INT,
85 'title' => ts('Membership Payment ID'),
86 'required' => TRUE,
87 'table_name' => 'civicrm_membership_payment',
88 'entity' => 'MembershipPayment',
89 'bao' => 'CRM_Member_BAO_MembershipPayment',
90 'localizable' => 0,
91 ],
92 'membership_id' => [
93 'name' => 'membership_id',
94 'type' => CRM_Utils_Type::T_INT,
95 'title' => ts('Membership'),
96 'description' => ts('FK to Membership table'),
97 'required' => TRUE,
98 'table_name' => 'civicrm_membership_payment',
99 'entity' => 'MembershipPayment',
100 'bao' => 'CRM_Member_BAO_MembershipPayment',
101 'localizable' => 0,
102 'FKClassName' => 'CRM_Member_DAO_Membership',
103 ],
104 'contribution_id' => [
105 'name' => 'contribution_id',
106 'type' => CRM_Utils_Type::T_INT,
107 'title' => ts('Contribution'),
108 'description' => ts('FK to contribution table.'),
109 'table_name' => 'civicrm_membership_payment',
110 'entity' => 'MembershipPayment',
111 'bao' => 'CRM_Member_BAO_MembershipPayment',
112 'localizable' => 0,
113 'FKClassName' => 'CRM_Contribute_DAO_Contribution',
114 ],
115 ];
116 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
117 }
118 return Civi::$statics[__CLASS__]['fields'];
119 }
120
121 /**
122 * Return a mapping from field-name to the corresponding key (as used in fields()).
123 *
124 * @return array
125 * Array(string $name => string $uniqueName).
126 */
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()));
130 }
131 return Civi::$statics[__CLASS__]['fieldKeys'];
132 }
133
134 /**
135 * Returns the names of this table
136 *
137 * @return string
138 */
139 public static function getTableName() {
140 return self::$_tableName;
141 }
142
143 /**
144 * Returns if this table needs to be logged
145 *
146 * @return bool
147 */
148 public function getLog() {
149 return self::$_log;
150 }
151
152 /**
153 * Returns the list of fields that can be imported
154 *
155 * @param bool $prefix
156 *
157 * @return array
158 */
159 public static function &import($prefix = FALSE) {
160 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_payment', $prefix, []);
161 return $r;
162 }
163
164 /**
165 * Returns the list of fields that can be exported
166 *
167 * @param bool $prefix
168 *
169 * @return array
170 */
171 public static function &export($prefix = FALSE) {
172 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_payment', $prefix, []);
173 return $r;
174 }
175
176 /**
177 * Returns the list of indices
178 *
179 * @param bool $localize
180 *
181 * @return array
182 */
183 public static function indices($localize = TRUE) {
184 $indices = [
185 'UI_contribution_membership' => [
186 'name' => 'UI_contribution_membership',
187 'field' => [
188 0 => 'contribution_id',
189 1 => 'membership_id',
190 ],
191 'localizable' => FALSE,
192 'unique' => TRUE,
193 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id',
194 ],
195 ];
196 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
197 }
198
199 }