Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Member/Membership.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e136f704 | 9 | * (GenCodeChecksum:643f191c50bbd0244e93745a929ba499) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Membership Id | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * FK to Contact ID | |
40 | * | |
41 | * @var int unsigned | |
42 | */ | |
43 | public $contact_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * FK to Membership Type | |
47 | * | |
48 | * @var int unsigned | |
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 | * | |
81 | * @var int unsigned | |
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 | * | |
88 | * @var boolean | |
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 | * | |
102 | * @var int unsigned | |
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 | /** |
e501603b TO |
114 | * @var boolean |
115 | */ | |
116 | public $is_test; | |
c3fc2621 | 117 | |
e501603b | 118 | /** |
e501603b TO |
119 | * @var boolean |
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 | * | |
126 | * @var int unsigned | |
127 | */ | |
128 | public $contribution_recur_id; | |
c3fc2621 | 129 | |
e501603b TO |
130 | /** |
131 | * The campaign for which this membership is attached. | |
132 | * | |
133 | * @var int unsigned | |
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 TO |
152 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
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'), |
e501603b | 177 | 'description' => 'Membership Id', |
c3fc2621 CW |
178 | 'required' => TRUE, |
179 | 'import' => TRUE, | |
e501603b TO |
180 | 'where' => 'civicrm_membership.id', |
181 | 'headerPattern' => '/^(m(embership\s)?id)$/i', | |
182 | 'dataPattern' => '', | |
c3fc2621 | 183 | 'export' => TRUE, |
522a26c9 | 184 | 'table_name' => 'civicrm_membership', |
185 | 'entity' => 'Membership', | |
186 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 187 | 'localizable' => 0, |
c3fc2621 CW |
188 | ], |
189 | 'membership_contact_id' => [ | |
e501603b TO |
190 | 'name' => 'contact_id', |
191 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 192 | 'title' => ts('Contact ID'), |
e501603b | 193 | 'description' => 'FK to Contact ID', |
c3fc2621 CW |
194 | 'required' => TRUE, |
195 | 'import' => TRUE, | |
e501603b TO |
196 | 'where' => 'civicrm_membership.contact_id', |
197 | 'headerPattern' => '/contact(.?id)?/i', | |
198 | 'dataPattern' => '/^\d+$/', | |
c3fc2621 | 199 | 'export' => TRUE, |
522a26c9 | 200 | 'table_name' => 'civicrm_membership', |
201 | 'entity' => 'Membership', | |
202 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 203 | 'localizable' => 0, |
e501603b | 204 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 | 205 | 'html' => [ |
e501603b | 206 | 'type' => 'EntityRef', |
c3fc2621 CW |
207 | ], |
208 | ], | |
209 | 'membership_type_id' => [ | |
e501603b TO |
210 | 'name' => 'membership_type_id', |
211 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 212 | 'title' => ts('Membership Type Id'), |
e501603b | 213 | 'description' => 'FK to Membership Type', |
c3fc2621 CW |
214 | 'required' => TRUE, |
215 | 'import' => TRUE, | |
e501603b TO |
216 | 'where' => 'civicrm_membership.membership_type_id', |
217 | 'headerPattern' => '/^(m(embership\s)?type)$/i', | |
218 | 'dataPattern' => '', | |
c3fc2621 | 219 | 'export' => FALSE, |
522a26c9 | 220 | 'table_name' => 'civicrm_membership', |
221 | 'entity' => 'Membership', | |
222 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 223 | 'localizable' => 0, |
e501603b | 224 | 'FKClassName' => 'CRM_Member_DAO_MembershipType', |
c3fc2621 | 225 | 'html' => [ |
e501603b | 226 | 'type' => 'Select', |
c3fc2621 CW |
227 | ], |
228 | 'pseudoconstant' => [ | |
e501603b TO |
229 | 'table' => 'civicrm_membership_type', |
230 | 'keyColumn' => 'id', | |
231 | 'labelColumn' => 'name', | |
c3fc2621 CW |
232 | ] |
233 | ], | |
234 | 'join_date' => [ | |
e501603b TO |
235 | 'name' => 'join_date', |
236 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 237 | 'title' => ts('Member Since'), |
e501603b | 238 | 'description' => 'Beginning of initial membership period (member since...).', |
c3fc2621 | 239 | 'import' => TRUE, |
e501603b TO |
240 | 'where' => 'civicrm_membership.join_date', |
241 | 'headerPattern' => '/^join|(j(oin\s)?date)$/i', | |
242 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 243 | 'export' => TRUE, |
522a26c9 | 244 | 'table_name' => 'civicrm_membership', |
245 | 'entity' => 'Membership', | |
246 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 247 | 'localizable' => 0, |
c3fc2621 | 248 | 'html' => [ |
e501603b | 249 | 'type' => 'Select Date', |
24317d89 | 250 | 'formatType' => 'activityDate', |
c3fc2621 CW |
251 | ], |
252 | ], | |
253 | 'membership_start_date' => [ | |
e501603b TO |
254 | 'name' => 'start_date', |
255 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 256 | 'title' => ts('Membership Start Date'), |
e501603b | 257 | 'description' => 'Beginning of current uninterrupted membership period.', |
c3fc2621 | 258 | 'import' => TRUE, |
e501603b TO |
259 | 'where' => 'civicrm_membership.start_date', |
260 | 'headerPattern' => '/(member(ship)?.)?start(s)?(.date$)?/i', | |
261 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 262 | 'export' => TRUE, |
522a26c9 | 263 | 'table_name' => 'civicrm_membership', |
264 | 'entity' => 'Membership', | |
265 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 266 | 'localizable' => 0, |
c3fc2621 | 267 | 'html' => [ |
e501603b | 268 | 'type' => 'Select Date', |
24317d89 | 269 | 'formatType' => 'activityDate', |
c3fc2621 CW |
270 | ], |
271 | ], | |
272 | 'membership_end_date' => [ | |
e501603b TO |
273 | 'name' => 'end_date', |
274 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 275 | 'title' => ts('Membership Expiration Date'), |
e501603b | 276 | 'description' => 'Current membership period expire date.', |
c3fc2621 | 277 | 'import' => TRUE, |
e501603b TO |
278 | 'where' => 'civicrm_membership.end_date', |
279 | 'headerPattern' => '/(member(ship)?.)?end(s)?(.date$)?/i', | |
280 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
c3fc2621 | 281 | 'export' => TRUE, |
522a26c9 | 282 | 'table_name' => 'civicrm_membership', |
283 | 'entity' => 'Membership', | |
284 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 285 | 'localizable' => 0, |
c3fc2621 | 286 | 'html' => [ |
e501603b | 287 | 'type' => 'Select Date', |
24317d89 | 288 | 'formatType' => 'activityDate', |
c3fc2621 CW |
289 | ], |
290 | ], | |
291 | 'membership_source' => [ | |
e501603b TO |
292 | 'name' => 'source', |
293 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 294 | 'title' => ts('Source'), |
e501603b TO |
295 | 'maxlength' => 128, |
296 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 297 | 'import' => TRUE, |
e501603b TO |
298 | 'where' => 'civicrm_membership.source', |
299 | 'headerPattern' => '/^(member(ship?))?source$/i', | |
300 | 'dataPattern' => '', | |
c3fc2621 | 301 | 'export' => TRUE, |
522a26c9 | 302 | 'table_name' => 'civicrm_membership', |
303 | 'entity' => 'Membership', | |
304 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 305 | 'localizable' => 0, |
c3fc2621 | 306 | 'html' => [ |
e501603b | 307 | 'type' => 'Text', |
c3fc2621 CW |
308 | ], |
309 | ], | |
310 | 'status_id' => [ | |
e501603b TO |
311 | 'name' => 'status_id', |
312 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 313 | 'title' => ts('Membership Status Id'), |
e501603b | 314 | 'description' => 'FK to Membership Status', |
c3fc2621 CW |
315 | 'required' => TRUE, |
316 | 'import' => TRUE, | |
e501603b TO |
317 | 'where' => 'civicrm_membership.status_id', |
318 | 'headerPattern' => '/(member(ship|).)?(status)$/i', | |
319 | 'dataPattern' => '', | |
c3fc2621 | 320 | 'export' => FALSE, |
522a26c9 | 321 | 'table_name' => 'civicrm_membership', |
322 | 'entity' => 'Membership', | |
323 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 324 | 'localizable' => 0, |
e501603b | 325 | 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', |
c3fc2621 | 326 | 'html' => [ |
e501603b | 327 | 'type' => 'Select', |
c3fc2621 CW |
328 | ], |
329 | 'pseudoconstant' => [ | |
e501603b TO |
330 | 'table' => 'civicrm_membership_status', |
331 | 'keyColumn' => 'id', | |
332 | 'labelColumn' => 'label', | |
c3fc2621 CW |
333 | ] |
334 | ], | |
335 | 'is_override' => [ | |
e501603b TO |
336 | 'name' => 'is_override', |
337 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 338 | 'title' => ts('Status Override'), |
e501603b | 339 | 'description' => '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 | 340 | 'import' => TRUE, |
e501603b TO |
341 | 'where' => 'civicrm_membership.is_override', |
342 | 'headerPattern' => '/override$/i', | |
343 | 'dataPattern' => '', | |
c3fc2621 | 344 | 'export' => TRUE, |
522a26c9 | 345 | 'table_name' => 'civicrm_membership', |
346 | 'entity' => 'Membership', | |
347 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 348 | 'localizable' => 0, |
c3fc2621 | 349 | 'html' => [ |
e501603b | 350 | 'type' => 'CheckBox', |
c3fc2621 CW |
351 | ], |
352 | ], | |
e136f704 O |
353 | 'status_override_end_date' => [ |
354 | 'name' => 'status_override_end_date', | |
355 | 'type' => CRM_Utils_Type::T_DATE, | |
356 | 'title' => ts('Status Override End Date'), | |
357 | 'description' => 'Then end date of membership status override if \'Override until selected date\' override type is selected.', | |
358 | 'import' => TRUE, | |
359 | 'where' => 'civicrm_membership.status_override_end_date', | |
360 | 'headerPattern' => '', | |
361 | 'dataPattern' => '', | |
362 | 'export' => TRUE, | |
363 | 'default' => 'NULL', | |
364 | 'table_name' => 'civicrm_membership', | |
365 | 'entity' => 'Membership', | |
366 | 'bao' => 'CRM_Member_BAO_Membership', | |
367 | 'localizable' => 0, | |
368 | 'html' => [ | |
369 | 'type' => 'Select Date', | |
370 | ], | |
371 | ], | |
c3fc2621 | 372 | 'owner_membership_id' => [ |
e501603b TO |
373 | 'name' => 'owner_membership_id', |
374 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 375 | 'title' => ts('Primary Member ID'), |
e501603b | 376 | 'description' => 'Optional FK to Parent Membership.', |
c3fc2621 | 377 | 'export' => TRUE, |
e501603b TO |
378 | 'where' => 'civicrm_membership.owner_membership_id', |
379 | 'headerPattern' => '', | |
380 | 'dataPattern' => '', | |
522a26c9 | 381 | 'table_name' => 'civicrm_membership', |
382 | 'entity' => 'Membership', | |
383 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 384 | 'localizable' => 0, |
e501603b | 385 | 'FKClassName' => 'CRM_Member_DAO_Membership', |
c3fc2621 CW |
386 | ], |
387 | 'max_related' => [ | |
e501603b TO |
388 | 'name' => 'max_related', |
389 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 390 | 'title' => ts('Max Related'), |
e501603b | 391 | 'description' => 'Maximum number of related memberships (membership_type override).', |
522a26c9 | 392 | 'table_name' => 'civicrm_membership', |
393 | 'entity' => 'Membership', | |
394 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 395 | 'localizable' => 0, |
c3fc2621 | 396 | 'html' => [ |
e501603b | 397 | 'type' => 'Text', |
c3fc2621 CW |
398 | ], |
399 | ], | |
400 | 'member_is_test' => [ | |
e501603b TO |
401 | 'name' => 'is_test', |
402 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
403 | 'title' => ts('Test'), |
404 | 'import' => TRUE, | |
e501603b TO |
405 | 'where' => 'civicrm_membership.is_test', |
406 | 'headerPattern' => '/(is.)?test(.member(ship)?)?/i', | |
407 | 'dataPattern' => '', | |
c3fc2621 | 408 | 'export' => TRUE, |
522a26c9 | 409 | 'table_name' => 'civicrm_membership', |
410 | 'entity' => 'Membership', | |
411 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 412 | 'localizable' => 0, |
c3fc2621 | 413 | 'html' => [ |
e501603b | 414 | 'type' => 'CheckBox', |
c3fc2621 CW |
415 | ], |
416 | ], | |
417 | 'member_is_pay_later' => [ | |
e501603b TO |
418 | 'name' => 'is_pay_later', |
419 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 CW |
420 | 'title' => ts('Is Pay Later'), |
421 | 'import' => TRUE, | |
e501603b TO |
422 | 'where' => 'civicrm_membership.is_pay_later', |
423 | 'headerPattern' => '/(is.)?(pay(.)?later)$/i', | |
424 | 'dataPattern' => '', | |
c3fc2621 | 425 | 'export' => TRUE, |
522a26c9 | 426 | 'table_name' => 'civicrm_membership', |
427 | 'entity' => 'Membership', | |
428 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 429 | 'localizable' => 0, |
c3fc2621 | 430 | 'html' => [ |
e501603b | 431 | 'type' => 'CheckBox', |
c3fc2621 CW |
432 | ], |
433 | ], | |
434 | 'contribution_recur_id' => [ | |
e501603b TO |
435 | 'name' => 'contribution_recur_id', |
436 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 437 | 'title' => ts('Membership Recurring Contribution'), |
e501603b | 438 | 'description' => '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.', |
522a26c9 | 439 | 'table_name' => 'civicrm_membership', |
440 | 'entity' => 'Membership', | |
441 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 442 | 'localizable' => 0, |
e501603b | 443 | 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', |
c3fc2621 CW |
444 | ], |
445 | 'member_campaign_id' => [ | |
e501603b TO |
446 | 'name' => 'campaign_id', |
447 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 448 | 'title' => ts('Campaign'), |
e501603b | 449 | 'description' => 'The campaign for which this membership is attached.', |
c3fc2621 | 450 | 'import' => TRUE, |
e501603b TO |
451 | 'where' => 'civicrm_membership.campaign_id', |
452 | 'headerPattern' => '', | |
453 | 'dataPattern' => '', | |
c3fc2621 | 454 | 'export' => TRUE, |
522a26c9 | 455 | 'table_name' => 'civicrm_membership', |
456 | 'entity' => 'Membership', | |
457 | 'bao' => 'CRM_Member_BAO_Membership', | |
6a7e5e5d | 458 | 'localizable' => 0, |
e501603b | 459 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 460 | 'html' => [ |
e501603b | 461 | 'type' => 'Select', |
c3fc2621 CW |
462 | ], |
463 | 'pseudoconstant' => [ | |
e501603b TO |
464 | 'table' => 'civicrm_campaign', |
465 | 'keyColumn' => 'id', | |
466 | 'labelColumn' => 'title', | |
c3fc2621 CW |
467 | ] |
468 | ], | |
469 | ]; | |
346aaaba | 470 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 471 | } |
346aaaba | 472 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 473 | } |
c3fc2621 | 474 | |
e501603b | 475 | /** |
bd8e0b14 | 476 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
477 | * |
478 | * @return array | |
bd8e0b14 | 479 | * Array(string $name => string $uniqueName). |
e501603b | 480 | */ |
c3fc2621 | 481 | public static function &fieldKeys() { |
bd8e0b14 TO |
482 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
483 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 484 | } |
bd8e0b14 | 485 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 486 | } |
c3fc2621 | 487 | |
e501603b TO |
488 | /** |
489 | * Returns the names of this table | |
490 | * | |
491 | * @return string | |
492 | */ | |
c3fc2621 | 493 | public static function getTableName() { |
e501603b TO |
494 | return self::$_tableName; |
495 | } | |
c3fc2621 | 496 | |
e501603b TO |
497 | /** |
498 | * Returns if this table needs to be logged | |
499 | * | |
c3fc2621 | 500 | * @return bool |
e501603b | 501 | */ |
c3fc2621 | 502 | public function getLog() { |
e501603b TO |
503 | return self::$_log; |
504 | } | |
c3fc2621 | 505 | |
e501603b TO |
506 | /** |
507 | * Returns the list of fields that can be imported | |
508 | * | |
509 | * @param bool $prefix | |
510 | * | |
511 | * @return array | |
512 | */ | |
c3fc2621 CW |
513 | public static function &import($prefix = FALSE) { |
514 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership', $prefix, []); | |
60808919 | 515 | return $r; |
e501603b | 516 | } |
c3fc2621 | 517 | |
e501603b TO |
518 | /** |
519 | * Returns the list of fields that can be exported | |
520 | * | |
521 | * @param bool $prefix | |
522 | * | |
523 | * @return array | |
524 | */ | |
c3fc2621 CW |
525 | public static function &export($prefix = FALSE) { |
526 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership', $prefix, []); | |
60808919 | 527 | return $r; |
e501603b | 528 | } |
c3fc2621 | 529 | |
e7a6b91a AS |
530 | /** |
531 | * Returns the list of indices | |
c3fc2621 CW |
532 | * |
533 | * @param bool $localize | |
534 | * | |
535 | * @return array | |
e7a6b91a AS |
536 | */ |
537 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
538 | $indices = [ |
539 | 'index_owner_membership_id' => [ | |
e7a6b91a | 540 | 'name' => 'index_owner_membership_id', |
c3fc2621 | 541 | 'field' => [ |
e7a6b91a | 542 | 0 => 'owner_membership_id', |
c3fc2621 CW |
543 | ], |
544 | 'localizable' => FALSE, | |
e7a6b91a | 545 | 'sig' => 'civicrm_membership::0::owner_membership_id', |
c3fc2621 CW |
546 | ], |
547 | ]; | |
e7a6b91a AS |
548 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
549 | } | |
c3fc2621 | 550 | |
e501603b | 551 | } |