Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Member/MembershipPayment.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
7b66c3b5 | 9 | * (GenCodeChecksum:e9764dc46ae261f8cad8ef1383063d61) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the MembershipPayment entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Member_DAO_MembershipPayment extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.5'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_membership_payment'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = TRUE; |
c3fc2621 | 32 | |
e501603b | 33 | /** |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to Membership table | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $membership_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * FK to contribution table. | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
49 | */ |
50 | public $contribution_id; | |
c3fc2621 | 51 | |
e501603b | 52 | /** |
f41f0342 | 53 | * Class constructor. |
e501603b | 54 | */ |
c3fc2621 | 55 | public function __construct() { |
e501603b TO |
56 | $this->__table = 'civicrm_membership_payment'; |
57 | parent::__construct(); | |
58 | } | |
c3fc2621 | 59 | |
449c4e6b CW |
60 | /** |
61 | * Returns localized title of this entity. | |
7b66c3b5 AH |
62 | * |
63 | * @param bool $plural | |
64 | * Whether to return the plural version of the title. | |
449c4e6b | 65 | */ |
7b66c3b5 AH |
66 | public static function getEntityTitle($plural = FALSE) { |
67 | return $plural ? ts('Membership Payments') : ts('Membership Payment'); | |
449c4e6b CW |
68 | } |
69 | ||
e501603b | 70 | /** |
f41f0342 | 71 | * Returns foreign keys and entity references. |
e501603b TO |
72 | * |
73 | * @return array | |
74 | * [CRM_Core_Reference_Interface] | |
75 | */ | |
c3fc2621 | 76 | public static function getReferenceColumns() { |
346aaaba | 77 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 78 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
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'); | |
346aaaba | 81 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 82 | } |
346aaaba | 83 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 84 | } |
c3fc2621 | 85 | |
e501603b TO |
86 | /** |
87 | * Returns all the column names of this table | |
88 | * | |
89 | * @return array | |
90 | */ | |
c3fc2621 | 91 | public static function &fields() { |
346aaaba | 92 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
93 | Civi::$statics[__CLASS__]['fields'] = [ |
94 | 'id' => [ | |
e501603b TO |
95 | 'name' => 'id', |
96 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
97 | 'title' => ts('Membership Payment ID'), |
98 | 'required' => TRUE, | |
a36434b9 | 99 | 'where' => 'civicrm_membership_payment.id', |
522a26c9 | 100 | 'table_name' => 'civicrm_membership_payment', |
101 | 'entity' => 'MembershipPayment', | |
102 | 'bao' => 'CRM_Member_BAO_MembershipPayment', | |
6a7e5e5d | 103 | 'localizable' => 0, |
a9d0587b | 104 | 'add' => '1.5', |
c3fc2621 CW |
105 | ], |
106 | 'membership_id' => [ | |
e501603b TO |
107 | 'name' => 'membership_id', |
108 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 109 | 'title' => ts('Membership'), |
215b423e | 110 | 'description' => ts('FK to Membership table'), |
c3fc2621 | 111 | 'required' => TRUE, |
a36434b9 | 112 | 'where' => 'civicrm_membership_payment.membership_id', |
522a26c9 | 113 | 'table_name' => 'civicrm_membership_payment', |
114 | 'entity' => 'MembershipPayment', | |
115 | 'bao' => 'CRM_Member_BAO_MembershipPayment', | |
6a7e5e5d | 116 | 'localizable' => 0, |
e501603b | 117 | 'FKClassName' => 'CRM_Member_DAO_Membership', |
a9d0587b | 118 | 'add' => '1.5', |
c3fc2621 CW |
119 | ], |
120 | 'contribution_id' => [ | |
e501603b TO |
121 | 'name' => 'contribution_id', |
122 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 123 | 'title' => ts('Contribution'), |
215b423e | 124 | 'description' => ts('FK to contribution table.'), |
a36434b9 | 125 | 'where' => 'civicrm_membership_payment.contribution_id', |
522a26c9 | 126 | 'table_name' => 'civicrm_membership_payment', |
127 | 'entity' => 'MembershipPayment', | |
128 | 'bao' => 'CRM_Member_BAO_MembershipPayment', | |
6a7e5e5d | 129 | 'localizable' => 0, |
e501603b | 130 | 'FKClassName' => 'CRM_Contribute_DAO_Contribution', |
a9d0587b | 131 | 'add' => '2.0', |
c3fc2621 CW |
132 | ], |
133 | ]; | |
346aaaba | 134 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 135 | } |
346aaaba | 136 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 137 | } |
c3fc2621 | 138 | |
e501603b | 139 | /** |
bd8e0b14 | 140 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
141 | * |
142 | * @return array | |
bd8e0b14 | 143 | * Array(string $name => string $uniqueName). |
e501603b | 144 | */ |
c3fc2621 | 145 | public static function &fieldKeys() { |
bd8e0b14 TO |
146 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
147 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 148 | } |
bd8e0b14 | 149 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 150 | } |
c3fc2621 | 151 | |
e501603b TO |
152 | /** |
153 | * Returns the names of this table | |
154 | * | |
155 | * @return string | |
156 | */ | |
c3fc2621 | 157 | public static function getTableName() { |
e501603b TO |
158 | return self::$_tableName; |
159 | } | |
c3fc2621 | 160 | |
e501603b TO |
161 | /** |
162 | * Returns if this table needs to be logged | |
163 | * | |
c3fc2621 | 164 | * @return bool |
e501603b | 165 | */ |
c3fc2621 | 166 | public function getLog() { |
e501603b TO |
167 | return self::$_log; |
168 | } | |
c3fc2621 | 169 | |
e501603b TO |
170 | /** |
171 | * Returns the list of fields that can be imported | |
172 | * | |
173 | * @param bool $prefix | |
174 | * | |
175 | * @return array | |
176 | */ | |
c3fc2621 CW |
177 | public static function &import($prefix = FALSE) { |
178 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_payment', $prefix, []); | |
60808919 | 179 | return $r; |
e501603b | 180 | } |
c3fc2621 | 181 | |
e501603b TO |
182 | /** |
183 | * Returns the list of fields that can be exported | |
184 | * | |
185 | * @param bool $prefix | |
186 | * | |
187 | * @return array | |
188 | */ | |
c3fc2621 CW |
189 | public static function &export($prefix = FALSE) { |
190 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_payment', $prefix, []); | |
60808919 | 191 | return $r; |
e501603b | 192 | } |
c3fc2621 | 193 | |
e7a6b91a AS |
194 | /** |
195 | * Returns the list of indices | |
c3fc2621 CW |
196 | * |
197 | * @param bool $localize | |
198 | * | |
199 | * @return array | |
e7a6b91a AS |
200 | */ |
201 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
202 | $indices = [ |
203 | 'UI_contribution_membership' => [ | |
e7a6b91a | 204 | 'name' => 'UI_contribution_membership', |
c3fc2621 | 205 | 'field' => [ |
e7a6b91a AS |
206 | 0 => 'contribution_id', |
207 | 1 => 'membership_id', | |
c3fc2621 CW |
208 | ], |
209 | 'localizable' => FALSE, | |
210 | 'unique' => TRUE, | |
e7a6b91a | 211 | 'sig' => 'civicrm_membership_payment::1::contribution_id::membership_id', |
c3fc2621 CW |
212 | ], |
213 | ]; | |
e7a6b91a AS |
214 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
215 | } | |
c3fc2621 | 216 | |
e501603b | 217 | } |