Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
6b83d5bd | 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Member/Membership.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
8f67d99a | 9 | * (GenCodeChecksum:40f3b0813c1e13fab544ae1f8fa2ebb3) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Membership entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Member_DAO_Membership extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_membership'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Membership Id | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to Contact ID | |
40 | * | |
e6ca0a57 | 41 | * @var int |
e501603b TO |
42 | */ |
43 | public $contact_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * FK to Membership Type | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
49 | */ |
50 | public $membership_type_id; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Beginning of initial membership period (member since...). | |
54 | * | |
55 | * @var date | |
56 | */ | |
57 | public $join_date; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Beginning of current uninterrupted membership period. | |
61 | * | |
62 | * @var date | |
63 | */ | |
64 | public $start_date; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * Current membership period expire date. | |
68 | * | |
69 | * @var date | |
70 | */ | |
71 | public $end_date; | |
c3fc2621 | 72 | |
e501603b | 73 | /** |
e501603b TO |
74 | * @var string |
75 | */ | |
76 | public $source; | |
c3fc2621 | 77 | |
e501603b TO |
78 | /** |
79 | * FK to Membership Status | |
80 | * | |
e6ca0a57 | 81 | * @var int |
e501603b TO |
82 | */ |
83 | public $status_id; | |
c3fc2621 | 84 | |
e501603b TO |
85 | /** |
86 | * Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record. | |
87 | * | |
e6ca0a57 | 88 | * @var bool |
e501603b TO |
89 | */ |
90 | public $is_override; | |
c3fc2621 | 91 | |
e136f704 O |
92 | /** |
93 | * Then end date of membership status override if 'Override until selected date' override type is selected. | |
94 | * | |
95 | * @var date | |
96 | */ | |
97 | public $status_override_end_date; | |
98 | ||
e501603b TO |
99 | /** |
100 | * Optional FK to Parent Membership. | |
101 | * | |
e6ca0a57 | 102 | * @var int |
e501603b TO |
103 | */ |
104 | public $owner_membership_id; | |
c3fc2621 | 105 | |
e501603b TO |
106 | /** |
107 | * Maximum number of related memberships (membership_type override). | |
108 | * | |
109 | * @var int | |
110 | */ | |
111 | public $max_related; | |
c3fc2621 | 112 | |
e501603b | 113 | /** |
e6ca0a57 | 114 | * @var bool |
e501603b TO |
115 | */ |
116 | public $is_test; | |
c3fc2621 | 117 | |
e501603b | 118 | /** |
e6ca0a57 | 119 | * @var bool |
e501603b TO |
120 | */ |
121 | public $is_pay_later; | |
c3fc2621 | 122 | |
e501603b TO |
123 | /** |
124 | * Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events. | |
125 | * | |
e6ca0a57 | 126 | * @var int |
e501603b TO |
127 | */ |
128 | public $contribution_recur_id; | |
c3fc2621 | 129 | |
e501603b TO |
130 | /** |
131 | * The campaign for which this membership is attached. | |
132 | * | |
e6ca0a57 | 133 | * @var int |
e501603b TO |
134 | */ |
135 | public $campaign_id; | |
c3fc2621 | 136 | |
e501603b | 137 | /** |
f41f0342 | 138 | * Class constructor. |
e501603b | 139 | */ |
c3fc2621 | 140 | public function __construct() { |
e501603b TO |
141 | $this->__table = 'civicrm_membership'; |
142 | parent::__construct(); | |
143 | } | |
c3fc2621 | 144 | |
e501603b | 145 | /** |
f41f0342 | 146 | * Returns foreign keys and entity references. |
e501603b TO |
147 | * |
148 | * @return array | |
149 | * [CRM_Core_Reference_Interface] | |
150 | */ | |
c3fc2621 | 151 | public static function getReferenceColumns() { |
346aaaba | 152 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 153 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
154 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
155 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id'); | |
156 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'status_id', 'civicrm_membership_status', 'id'); | |
157 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'owner_membership_id', 'civicrm_membership', 'id'); | |
158 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); | |
159 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id'); | |
346aaaba | 160 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 161 | } |
346aaaba | 162 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 163 | } |
c3fc2621 | 164 | |
e501603b TO |
165 | /** |
166 | * Returns all the column names of this table | |
167 | * | |
168 | * @return array | |
169 | */ | |
c3fc2621 | 170 | public static function &fields() { |
346aaaba | 171 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
172 | Civi::$statics[__CLASS__]['fields'] = [ |
173 | 'membership_id' => [ | |
e501603b TO |
174 | 'name' => 'id', |
175 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 176 | 'title' => ts('Membership ID'), |
215b423e | 177 | 'description' => ts('Membership Id'), |
c3fc2621 CW |
178 | 'required' => TRUE, |
179 | 'import' => TRUE, | |
e501603b TO |
180 | 'where' => 'civicrm_membership.id', |
181 | 'headerPattern' => '/^(m(embership\s)?id)$/i', | |
c3fc2621 | 182 | 'export' => TRUE, |
522a26c9 | 183 | 'table_name' => 'civicrm_membership', |
184 | 'entity' => 'Membership', | |
185 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 186 | 'localizable' => 0, |
c3fc2621 CW |
187 | ], |
188 | 'membership_contact_id' => [ | |
e501603b TO |
189 | 'name' => 'contact_id', |
190 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 191 | 'title' => ts('Contact ID'), |
215b423e | 192 | 'description' => ts('FK to Contact ID'), |
c3fc2621 CW |
193 | 'required' => TRUE, |
194 | 'import' => TRUE, | |
e501603b TO |
195 | 'where' => 'civicrm_membership.contact_id', |
196 | 'headerPattern' => '/contact(.?id)?/i', | |
197 | 'dataPattern' => '/^\d+$/', | |
c3fc2621 | 198 | 'export' => TRUE, |
522a26c9 | 199 | 'table_name' => 'civicrm_membership', |
200 | 'entity' => 'Membership', | |
201 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 202 | 'localizable' => 0, |
e501603b | 203 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 204 | 'html' => [ |
e501603b | 205 | 'type' => 'EntityRef', |
c3fc2621 CW |
206 | ], |
207 | ], | |
208 | 'membership_type_id' => [ | |
e501603b TO |
209 | 'name' => 'membership_type_id', |
210 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 211 | 'title' => ts('Membership Type Id'), |
215b423e | 212 | 'description' => ts('FK to Membership Type'), |
c3fc2621 CW |
213 | 'required' => TRUE, |
214 | 'import' => TRUE, | |
e501603b TO |
215 | 'where' => 'civicrm_membership.membership_type_id', |
216 | 'headerPattern' => '/^(m(embership\s)?type)$/i', | |
c3fc2621 | 217 | 'export' => FALSE, |
522a26c9 | 218 | 'table_name' => 'civicrm_membership', |
219 | 'entity' => 'Membership', | |
220 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 221 | 'localizable' => 0, |
e501603b | 222 | 'FKClassName' => 'CRM_Member_DAO_MembershipType', |
c3fc2621 | 223 | 'html' => [ |
e501603b | 224 | 'type' => 'Select', |
c3fc2621 CW |
225 | ], |
226 | 'pseudoconstant' => [ | |
e501603b TO |
227 | 'table' => 'civicrm_membership_type', |
228 | 'keyColumn' => 'id', | |
229 | 'labelColumn' => 'name', | |
e6ca0a57 | 230 | ], |
c3fc2621 CW |
231 | ], |
232 | 'join_date' => [ | |
e501603b TO |
233 | 'name' => 'join_date', |
234 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 235 | 'title' => ts('Member Since'), |
215b423e | 236 | 'description' => ts('Beginning of initial membership period (member since...).'), |
c3fc2621 | 237 | 'import' => TRUE, |
e501603b TO |
238 | 'where' => 'civicrm_membership.join_date', |
239 | 'headerPattern' => '/^join|(j(oin\s)?date)$/i', | |
240 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 241 | 'export' => TRUE, |
522a26c9 | 242 | 'table_name' => 'civicrm_membership', |
243 | 'entity' => 'Membership', | |
244 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 245 | 'localizable' => 0, |
c3fc2621 | 246 | 'html' => [ |
e501603b | 247 | 'type' => 'Select Date', |
24317d89 | 248 | 'formatType' => 'activityDate', |
c3fc2621 CW |
249 | ], |
250 | ], | |
251 | 'membership_start_date' => [ | |
e501603b TO |
252 | 'name' => 'start_date', |
253 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 254 | 'title' => ts('Membership Start Date'), |
215b423e | 255 | 'description' => ts('Beginning of current uninterrupted membership period.'), |
c3fc2621 | 256 | 'import' => TRUE, |
e501603b TO |
257 | 'where' => 'civicrm_membership.start_date', |
258 | 'headerPattern' => '/(member(ship)?.)?start(s)?(.date$)?/i', | |
259 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 260 | 'export' => TRUE, |
522a26c9 | 261 | 'table_name' => 'civicrm_membership', |
262 | 'entity' => 'Membership', | |
263 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 264 | 'localizable' => 0, |
c3fc2621 | 265 | 'html' => [ |
e501603b | 266 | 'type' => 'Select Date', |
24317d89 | 267 | 'formatType' => 'activityDate', |
c3fc2621 CW |
268 | ], |
269 | ], | |
270 | 'membership_end_date' => [ | |
e501603b TO |
271 | 'name' => 'end_date', |
272 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 273 | 'title' => ts('Membership Expiration Date'), |
215b423e | 274 | 'description' => ts('Current membership period expire date.'), |
c3fc2621 | 275 | 'import' => TRUE, |
e501603b TO |
276 | 'where' => 'civicrm_membership.end_date', |
277 | 'headerPattern' => '/(member(ship)?.)?end(s)?(.date$)?/i', | |
278 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 279 | 'export' => TRUE, |
522a26c9 | 280 | 'table_name' => 'civicrm_membership', |
281 | 'entity' => 'Membership', | |
282 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 283 | 'localizable' => 0, |
c3fc2621 | 284 | 'html' => [ |
e501603b | 285 | 'type' => 'Select Date', |
24317d89 | 286 | 'formatType' => 'activityDate', |
c3fc2621 CW |
287 | ], |
288 | ], | |
289 | 'membership_source' => [ | |
e501603b TO |
290 | 'name' => 'source', |
291 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 292 | 'title' => ts('Source'), |
e501603b TO |
293 | 'maxlength' => 128, |
294 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 295 | 'import' => TRUE, |
e501603b TO |
296 | 'where' => 'civicrm_membership.source', |
297 | 'headerPattern' => '/^(member(ship?))?source$/i', | |
c3fc2621 | 298 | 'export' => TRUE, |
522a26c9 | 299 | 'table_name' => 'civicrm_membership', |
300 | 'entity' => 'Membership', | |
301 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 302 | 'localizable' => 0, |
c3fc2621 | 303 | 'html' => [ |
e501603b | 304 | 'type' => 'Text', |
c3fc2621 CW |
305 | ], |
306 | ], | |
307 | 'status_id' => [ | |
e501603b TO |
308 | 'name' => 'status_id', |
309 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 310 | 'title' => ts('Membership Status Id'), |
215b423e | 311 | 'description' => ts('FK to Membership Status'), |
c3fc2621 CW |
312 | 'required' => TRUE, |
313 | 'import' => TRUE, | |
e501603b TO |
314 | 'where' => 'civicrm_membership.status_id', |
315 | 'headerPattern' => '/(member(ship|).)?(status)$/i', | |
c3fc2621 | 316 | 'export' => FALSE, |
522a26c9 | 317 | 'table_name' => 'civicrm_membership', |
318 | 'entity' => 'Membership', | |
319 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 320 | 'localizable' => 0, |
e501603b | 321 | 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', |
c3fc2621 | 322 | 'html' => [ |
e501603b | 323 | 'type' => 'Select', |
c3fc2621 CW |
324 | ], |
325 | 'pseudoconstant' => [ | |
e501603b TO |
326 | 'table' => 'civicrm_membership_status', |
327 | 'keyColumn' => 'id', | |
328 | 'labelColumn' => 'label', | |
e6ca0a57 | 329 | ], |
c3fc2621 | 330 | ], |
8f67d99a | 331 | 'member_is_override' => [ |
e501603b TO |
332 | 'name' => 'is_override', |
333 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 334 | 'title' => ts('Status Override'), |
215b423e | 335 | 'description' => ts('Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record.'), |
c3fc2621 | 336 | 'import' => TRUE, |
e501603b TO |
337 | 'where' => 'civicrm_membership.is_override', |
338 | 'headerPattern' => '/override$/i', | |
c3fc2621 | 339 | 'export' => TRUE, |
522a26c9 | 340 | 'table_name' => 'civicrm_membership', |
341 | 'entity' => 'Membership', | |
342 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 343 | 'localizable' => 0, |
c3fc2621 | 344 | 'html' => [ |
e501603b | 345 | 'type' => 'CheckBox', |
c3fc2621 CW |
346 | ], |
347 | ], | |
e136f704 O |
348 | 'status_override_end_date' => [ |
349 | 'name' => 'status_override_end_date', | |
350 | 'type' => CRM_Utils_Type::T_DATE, | |
351 | 'title' => ts('Status Override End Date'), | |
215b423e | 352 | 'description' => ts('Then end date of membership status override if \'Override until selected date\' override type is selected.'), |
e136f704 O |
353 | 'import' => TRUE, |
354 | 'where' => 'civicrm_membership.status_override_end_date', | |
e136f704 O |
355 | 'export' => TRUE, |
356 | 'default' => 'NULL', | |
357 | 'table_name' => 'civicrm_membership', | |
358 | 'entity' => 'Membership', | |
359 | 'bao' => 'CRM_Member_BAO_Membership', | |
360 | 'localizable' => 0, | |
361 | 'html' => [ | |
362 | 'type' => 'Select Date', | |
363 | ], | |
364 | ], | |
c3fc2621 | 365 | 'owner_membership_id' => [ |
e501603b TO |
366 | 'name' => 'owner_membership_id', |
367 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 368 | 'title' => ts('Primary Member ID'), |
215b423e | 369 | 'description' => ts('Optional FK to Parent Membership.'), |
e501603b | 370 | 'where' => 'civicrm_membership.owner_membership_id', |
a36434b9 | 371 | 'export' => TRUE, |
522a26c9 | 372 | 'table_name' => 'civicrm_membership', |
373 | 'entity' => 'Membership', | |
374 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 375 | 'localizable' => 0, |
e501603b | 376 | 'FKClassName' => 'CRM_Member_DAO_Membership', |
c3fc2621 CW |
377 | ], |
378 | 'max_related' => [ | |
e501603b TO |
379 | 'name' => 'max_related', |
380 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 381 | 'title' => ts('Max Related'), |
215b423e | 382 | 'description' => ts('Maximum number of related memberships (membership_type override).'), |
a36434b9 | 383 | 'where' => 'civicrm_membership.max_related', |
8f67d99a | 384 | 'export' => TRUE, |
522a26c9 | 385 | 'table_name' => 'civicrm_membership', |
386 | 'entity' => 'Membership', | |
387 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 388 | 'localizable' => 0, |
c3fc2621 | 389 | 'html' => [ |
e501603b | 390 | 'type' => 'Text', |
c3fc2621 CW |
391 | ], |
392 | ], | |
393 | 'member_is_test' => [ | |
e501603b TO |
394 | 'name' => 'is_test', |
395 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
396 | 'title' => ts('Test'), |
397 | 'import' => TRUE, | |
e501603b TO |
398 | 'where' => 'civicrm_membership.is_test', |
399 | 'headerPattern' => '/(is.)?test(.member(ship)?)?/i', | |
c3fc2621 | 400 | 'export' => TRUE, |
45a83e42 | 401 | 'default' => '0', |
522a26c9 | 402 | 'table_name' => 'civicrm_membership', |
403 | 'entity' => 'Membership', | |
404 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 405 | 'localizable' => 0, |
c3fc2621 | 406 | 'html' => [ |
e501603b | 407 | 'type' => 'CheckBox', |
c3fc2621 CW |
408 | ], |
409 | ], | |
410 | 'member_is_pay_later' => [ | |
e501603b TO |
411 | 'name' => 'is_pay_later', |
412 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
413 | 'title' => ts('Is Pay Later'), |
414 | 'import' => TRUE, | |
e501603b TO |
415 | 'where' => 'civicrm_membership.is_pay_later', |
416 | 'headerPattern' => '/(is.)?(pay(.)?later)$/i', | |
c3fc2621 | 417 | 'export' => TRUE, |
45a83e42 | 418 | 'default' => '0', |
522a26c9 | 419 | 'table_name' => 'civicrm_membership', |
420 | 'entity' => 'Membership', | |
421 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 422 | 'localizable' => 0, |
c3fc2621 | 423 | 'html' => [ |
e501603b | 424 | 'type' => 'CheckBox', |
c3fc2621 CW |
425 | ], |
426 | ], | |
8f67d99a | 427 | 'membership_recur_id' => [ |
e501603b TO |
428 | 'name' => 'contribution_recur_id', |
429 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 430 | 'title' => ts('Membership Recurring Contribution'), |
215b423e | 431 | 'description' => ts('Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.'), |
a36434b9 | 432 | 'where' => 'civicrm_membership.contribution_recur_id', |
8f67d99a | 433 | 'export' => TRUE, |
522a26c9 | 434 | 'table_name' => 'civicrm_membership', |
435 | 'entity' => 'Membership', | |
436 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 437 | 'localizable' => 0, |
e501603b | 438 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', |
c3fc2621 CW |
439 | ], |
440 | 'member_campaign_id' => [ | |
e501603b TO |
441 | 'name' => 'campaign_id', |
442 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 443 | 'title' => ts('Campaign'), |
215b423e | 444 | 'description' => ts('The campaign for which this membership is attached.'), |
c3fc2621 | 445 | 'import' => TRUE, |
e501603b | 446 | 'where' => 'civicrm_membership.campaign_id', |
c3fc2621 | 447 | 'export' => TRUE, |
522a26c9 | 448 | 'table_name' => 'civicrm_membership', |
449 | 'entity' => 'Membership', | |
450 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 451 | 'localizable' => 0, |
e501603b | 452 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 453 | 'html' => [ |
e501603b | 454 | 'type' => 'Select', |
c3fc2621 CW |
455 | ], |
456 | 'pseudoconstant' => [ | |
e501603b TO |
457 | 'table' => 'civicrm_campaign', |
458 | 'keyColumn' => 'id', | |
459 | 'labelColumn' => 'title', | |
e6ca0a57 | 460 | ], |
c3fc2621 CW |
461 | ], |
462 | ]; | |
346aaaba | 463 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 464 | } |
346aaaba | 465 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 466 | } |
c3fc2621 | 467 | |
e501603b | 468 | /** |
bd8e0b14 | 469 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
470 | * |
471 | * @return array | |
bd8e0b14 | 472 | * Array(string $name => string $uniqueName). |
e501603b | 473 | */ |
c3fc2621 | 474 | public static function &fieldKeys() { |
bd8e0b14 TO |
475 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
476 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 477 | } |
bd8e0b14 | 478 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 479 | } |
c3fc2621 | 480 | |
e501603b TO |
481 | /** |
482 | * Returns the names of this table | |
483 | * | |
484 | * @return string | |
485 | */ | |
c3fc2621 | 486 | public static function getTableName() { |
e501603b TO |
487 | return self::$_tableName; |
488 | } | |
c3fc2621 | 489 | |
e501603b TO |
490 | /** |
491 | * Returns if this table needs to be logged | |
492 | * | |
c3fc2621 | 493 | * @return bool |
e501603b | 494 | */ |
c3fc2621 | 495 | public function getLog() { |
e501603b TO |
496 | return self::$_log; |
497 | } | |
c3fc2621 | 498 | |
e501603b TO |
499 | /** |
500 | * Returns the list of fields that can be imported | |
501 | * | |
502 | * @param bool $prefix | |
503 | * | |
504 | * @return array | |
505 | */ | |
c3fc2621 CW |
506 | public static function &import($prefix = FALSE) { |
507 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership', $prefix, []); | |
60808919 | 508 | return $r; |
e501603b | 509 | } |
c3fc2621 | 510 | |
e501603b TO |
511 | /** |
512 | * Returns the list of fields that can be exported | |
513 | * | |
514 | * @param bool $prefix | |
515 | * | |
516 | * @return array | |
517 | */ | |
c3fc2621 CW |
518 | public static function &export($prefix = FALSE) { |
519 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership', $prefix, []); | |
60808919 | 520 | return $r; |
e501603b | 521 | } |
c3fc2621 | 522 | |
e7a6b91a AS |
523 | /** |
524 | * Returns the list of indices | |
c3fc2621 CW |
525 | * |
526 | * @param bool $localize | |
527 | * | |
528 | * @return array | |
e7a6b91a AS |
529 | */ |
530 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
531 | $indices = [ |
532 | 'index_owner_membership_id' => [ | |
e7a6b91a | 533 | 'name' => 'index_owner_membership_id', |
c3fc2621 | 534 | 'field' => [ |
e7a6b91a | 535 | 0 => 'owner_membership_id', |
c3fc2621 CW |
536 | ], |
537 | 'localizable' => FALSE, | |
e7a6b91a | 538 | 'sig' => 'civicrm_membership::0::owner_membership_id', |
c3fc2621 CW |
539 | ], |
540 | ]; | |
e7a6b91a AS |
541 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
542 | } | |
c3fc2621 | 543 | |
e501603b | 544 | } |