Merge pull request #15824 from mfb/email-search-speed-boost
[civicrm-core.git] / CRM / Member / DAO / MembershipType.php
CommitLineData
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/MembershipType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
f29bf4f3 9 * (GenCodeChecksum:c188b3772bd7ba843454e591a1fb0fd6)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MembershipType entity.
f41f0342 14 */
e501603b 15class CRM_Member_DAO_MembershipType 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_type';
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 * Which Domain is this match entry for
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $domain_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Name of Membership Type
47 *
48 * @var string
49 */
50 public $name;
c3fc2621 51
e501603b
TO
52 /**
53 * Description of Membership Type
54 *
55 * @var string
56 */
57 public $description;
c3fc2621 58
e501603b
TO
59 /**
60 * Owner organization for this membership type. FK to Contact ID
61 *
e6ca0a57 62 * @var int
e501603b
TO
63 */
64 public $member_of_contact_id;
c3fc2621 65
e501603b
TO
66 /**
67 * If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id
68 *
e6ca0a57 69 * @var int
e501603b
TO
70 */
71 public $financial_type_id;
c3fc2621 72
e501603b
TO
73 /**
74 * Minimum fee for this membership (0 for free/complimentary memberships).
75 *
76 * @var float
77 */
78 public $minimum_fee;
c3fc2621 79
e501603b
TO
80 /**
81 * Unit in which membership period is expressed.
82 *
83 * @var string
84 */
85 public $duration_unit;
c3fc2621 86
e501603b
TO
87 /**
88 * Number of duration units in membership period (e.g. 1 year, 12 months).
89 *
90 * @var int
91 */
92 public $duration_interval;
c3fc2621 93
e501603b
TO
94 /**
95 * Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.
96 *
97 * @var string
98 */
99 public $period_type;
c3fc2621 100
e501603b
TO
101 /**
102 * For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.
103 *
104 * @var int
105 */
106 public $fixed_period_start_day;
c3fc2621 107
e501603b
TO
108 /**
109 * For fixed period memberships, signups after this day (mmdd) rollover to next period.
110 *
111 * @var int
112 */
113 public $fixed_period_rollover_day;
c3fc2621 114
e501603b
TO
115 /**
116 * FK to Relationship Type ID
117 *
118 * @var string
119 */
120 public $relationship_type_id;
c3fc2621 121
e501603b 122 /**
e501603b
TO
123 * @var string
124 */
125 public $relationship_direction;
c3fc2621 126
e501603b
TO
127 /**
128 * Maximum number of related memberships.
129 *
130 * @var int
131 */
132 public $max_related;
c3fc2621 133
e501603b 134 /**
e501603b
TO
135 * @var string
136 */
137 public $visibility;
c3fc2621 138
e501603b 139 /**
e501603b
TO
140 * @var int
141 */
142 public $weight;
c3fc2621 143
e501603b
TO
144 /**
145 * Receipt Text for membership signup
146 *
147 * @var string
148 */
149 public $receipt_text_signup;
c3fc2621 150
e501603b
TO
151 /**
152 * Receipt Text for membership renewal
153 *
154 * @var string
155 */
156 public $receipt_text_renewal;
c3fc2621 157
e501603b
TO
158 /**
159 * 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;
160 *
e6ca0a57 161 * @var bool
e501603b
TO
162 */
163 public $auto_renew;
c3fc2621 164
e501603b
TO
165 /**
166 * Is this membership_type enabled
167 *
e6ca0a57 168 * @var bool
e501603b
TO
169 */
170 public $is_active;
c3fc2621 171
e501603b 172 /**
f41f0342 173 * Class constructor.
e501603b 174 */
c3fc2621 175 public function __construct() {
e501603b
TO
176 $this->__table = 'civicrm_membership_type';
177 parent::__construct();
178 }
c3fc2621 179
e501603b 180 /**
f41f0342 181 * Returns foreign keys and entity references.
e501603b
TO
182 *
183 * @return array
184 * [CRM_Core_Reference_Interface]
185 */
c3fc2621 186 public static function getReferenceColumns() {
346aaaba 187 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 188 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
189 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
190 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'member_of_contact_id', 'civicrm_contact', 'id');
191 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
346aaaba 192 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 193 }
346aaaba 194 return Civi::$statics[__CLASS__]['links'];
e501603b 195 }
c3fc2621 196
e501603b
TO
197 /**
198 * Returns all the column names of this table
199 *
200 * @return array
201 */
c3fc2621 202 public static function &fields() {
346aaaba 203 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
204 Civi::$statics[__CLASS__]['fields'] = [
205 'id' => [
e501603b
TO
206 'name' => 'id',
207 'type' => CRM_Utils_Type::T_INT,
c3fc2621 208 'title' => ts('Membership Type ID'),
215b423e 209 'description' => ts('Membership Id'),
c3fc2621 210 'required' => TRUE,
a36434b9 211 'where' => 'civicrm_membership_type.id',
522a26c9 212 'table_name' => 'civicrm_membership_type',
213 'entity' => 'MembershipType',
214 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 215 'localizable' => 0,
c3fc2621
CW
216 ],
217 'domain_id' => [
e501603b
TO
218 'name' => 'domain_id',
219 'type' => CRM_Utils_Type::T_INT,
c3fc2621 220 'title' => ts('Membership Type Domain'),
215b423e 221 'description' => ts('Which Domain is this match entry for'),
c3fc2621 222 'required' => TRUE,
a36434b9 223 'where' => 'civicrm_membership_type.domain_id',
522a26c9 224 'table_name' => 'civicrm_membership_type',
225 'entity' => 'MembershipType',
226 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 227 'localizable' => 0,
e501603b 228 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 229 'pseudoconstant' => [
e501603b
TO
230 'table' => 'civicrm_domain',
231 'keyColumn' => 'id',
232 'labelColumn' => 'name',
e6ca0a57 233 ],
c3fc2621
CW
234 ],
235 'membership_type' => [
e501603b
TO
236 'name' => 'name',
237 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 238 'title' => ts('Membership Type'),
215b423e 239 'description' => ts('Name of Membership Type'),
e501603b
TO
240 'maxlength' => 128,
241 'size' => CRM_Utils_Type::HUGE,
c3fc2621 242 'import' => TRUE,
e501603b 243 'where' => 'civicrm_membership_type.name',
c3fc2621 244 'export' => TRUE,
522a26c9 245 'table_name' => 'civicrm_membership_type',
246 'entity' => 'MembershipType',
247 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 248 'localizable' => 1,
6f85d058 249 'html' => [
250 'type' => 'Text',
4361de53 251 'label' => ts("Name"),
6f85d058 252 ],
c3fc2621
CW
253 ],
254 'description' => [
e501603b
TO
255 'name' => 'description',
256 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 257 'title' => ts('Membership Type Description'),
215b423e 258 'description' => ts('Description of Membership Type'),
e501603b
TO
259 'maxlength' => 255,
260 'size' => CRM_Utils_Type::HUGE,
a36434b9 261 'where' => 'civicrm_membership_type.description',
522a26c9 262 'table_name' => 'civicrm_membership_type',
263 'entity' => 'MembershipType',
264 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 265 'localizable' => 1,
c3fc2621 266 'html' => [
e501603b 267 'type' => 'TextArea',
4361de53 268 'label' => ts("Description"),
c3fc2621
CW
269 ],
270 ],
271 'member_of_contact_id' => [
e501603b
TO
272 'name' => 'member_of_contact_id',
273 'type' => CRM_Utils_Type::T_INT,
c3fc2621 274 'title' => ts('Membership Type Organization'),
215b423e 275 'description' => ts('Owner organization for this membership type. FK to Contact ID'),
c3fc2621 276 'required' => TRUE,
a36434b9 277 'where' => 'civicrm_membership_type.member_of_contact_id',
522a26c9 278 'table_name' => 'civicrm_membership_type',
279 'entity' => 'MembershipType',
280 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 281 'localizable' => 0,
e501603b 282 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
283 ],
284 'financial_type_id' => [
e501603b
TO
285 'name' => 'financial_type_id',
286 'type' => CRM_Utils_Type::T_INT,
c3fc2621 287 'title' => ts('Membership Financial Type'),
215b423e 288 'description' => ts('If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id'),
c3fc2621 289 'required' => TRUE,
a36434b9 290 'where' => 'civicrm_membership_type.financial_type_id',
522a26c9 291 'table_name' => 'civicrm_membership_type',
292 'entity' => 'MembershipType',
293 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 294 'localizable' => 0,
e501603b 295 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
c3fc2621 296 'pseudoconstant' => [
e501603b
TO
297 'table' => 'civicrm_financial_type',
298 'keyColumn' => 'id',
299 'labelColumn' => 'name',
e6ca0a57 300 ],
c3fc2621
CW
301 ],
302 'minimum_fee' => [
e501603b
TO
303 'name' => 'minimum_fee',
304 'type' => CRM_Utils_Type::T_MONEY,
6f85d058 305 'title' => ts('Membership Type Minimum Fee'),
215b423e 306 'description' => ts('Minimum fee for this membership (0 for free/complimentary memberships).'),
c3fc2621 307 'precision' => [
25e0f950 308 18,
fb607354 309 9,
c3fc2621 310 ],
a36434b9 311 'where' => 'civicrm_membership_type.minimum_fee',
45a83e42 312 'default' => '0',
522a26c9 313 'table_name' => 'civicrm_membership_type',
314 'entity' => 'MembershipType',
315 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 316 'localizable' => 0,
6f85d058 317 'html' => [
318 'type' => 'Text',
4361de53 319 'label' => ts("Minimum Fee"),
6f85d058 320 ],
c3fc2621
CW
321 ],
322 'duration_unit' => [
e501603b
TO
323 'name' => 'duration_unit',
324 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 325 'title' => ts('Membership Type Duration Unit'),
215b423e 326 'description' => ts('Unit in which membership period is expressed.'),
e501603b
TO
327 'maxlength' => 8,
328 'size' => CRM_Utils_Type::EIGHT,
a36434b9 329 'where' => 'civicrm_membership_type.duration_unit',
522a26c9 330 'table_name' => 'civicrm_membership_type',
331 'entity' => 'MembershipType',
332 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 333 'localizable' => 0,
c3fc2621 334 'html' => [
e501603b 335 'type' => 'Select',
c3fc2621
CW
336 ],
337 'pseudoconstant' => [
e501603b 338 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
e6ca0a57 339 ],
c3fc2621
CW
340 ],
341 'duration_interval' => [
e501603b
TO
342 'name' => 'duration_interval',
343 'type' => CRM_Utils_Type::T_INT,
c3fc2621 344 'title' => ts('Membership Type Duration Interval'),
215b423e 345 'description' => ts('Number of duration units in membership period (e.g. 1 year, 12 months).'),
a36434b9 346 'where' => 'civicrm_membership_type.duration_interval',
522a26c9 347 'table_name' => 'civicrm_membership_type',
348 'entity' => 'MembershipType',
349 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 350 'localizable' => 0,
6f85d058 351 'html' => [
352 'type' => 'Text',
353 ],
c3fc2621
CW
354 ],
355 'period_type' => [
e501603b
TO
356 'name' => 'period_type',
357 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 358 'title' => ts('Membership Type Plan'),
215b423e 359 'description' => ts('Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'),
e501603b
TO
360 'maxlength' => 8,
361 'size' => CRM_Utils_Type::EIGHT,
a36434b9 362 'where' => 'civicrm_membership_type.period_type',
522a26c9 363 'table_name' => 'civicrm_membership_type',
364 'entity' => 'MembershipType',
365 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 366 'localizable' => 0,
6f85d058 367 'html' => [
368 'type' => 'Select',
369 ],
c3fc2621 370 'pseudoconstant' => [
e501603b 371 'callback' => 'CRM_Core_SelectValues::periodType',
e6ca0a57 372 ],
c3fc2621
CW
373 ],
374 'fixed_period_start_day' => [
e501603b
TO
375 'name' => 'fixed_period_start_day',
376 'type' => CRM_Utils_Type::T_INT,
c3fc2621 377 'title' => ts('Fixed Period Start Day'),
215b423e 378 'description' => ts('For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.'),
a36434b9 379 'where' => 'civicrm_membership_type.fixed_period_start_day',
522a26c9 380 'table_name' => 'civicrm_membership_type',
381 'entity' => 'MembershipType',
382 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 383 'localizable' => 0,
c3fc2621
CW
384 ],
385 'fixed_period_rollover_day' => [
e501603b
TO
386 'name' => 'fixed_period_rollover_day',
387 'type' => CRM_Utils_Type::T_INT,
c3fc2621 388 'title' => ts('Fixed Period Rollover Day'),
215b423e 389 'description' => ts('For fixed period memberships, signups after this day (mmdd) rollover to next period.'),
a36434b9 390 'where' => 'civicrm_membership_type.fixed_period_rollover_day',
522a26c9 391 'table_name' => 'civicrm_membership_type',
392 'entity' => 'MembershipType',
393 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 394 'localizable' => 0,
c3fc2621
CW
395 ],
396 'relationship_type_id' => [
e501603b
TO
397 'name' => 'relationship_type_id',
398 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 399 'title' => ts('Membership Type Relationship'),
215b423e 400 'description' => ts('FK to Relationship Type ID'),
e501603b
TO
401 'maxlength' => 64,
402 'size' => CRM_Utils_Type::BIG,
a36434b9 403 'where' => 'civicrm_membership_type.relationship_type_id',
522a26c9 404 'table_name' => 'civicrm_membership_type',
405 'entity' => 'MembershipType',
406 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 407 'localizable' => 0,
96c40ac7 408 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
c3fc2621
CW
409 ],
410 'relationship_direction' => [
e501603b
TO
411 'name' => 'relationship_direction',
412 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 413 'title' => ts('Relationship Direction'),
e501603b
TO
414 'maxlength' => 128,
415 'size' => CRM_Utils_Type::HUGE,
a36434b9 416 'where' => 'civicrm_membership_type.relationship_direction',
522a26c9 417 'table_name' => 'civicrm_membership_type',
418 'entity' => 'MembershipType',
419 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 420 'localizable' => 0,
96c40ac7 421 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
c3fc2621
CW
422 ],
423 'max_related' => [
e501603b
TO
424 'name' => 'max_related',
425 'type' => CRM_Utils_Type::T_INT,
c3fc2621 426 'title' => ts('Max Related Members for Type'),
215b423e 427 'description' => ts('Maximum number of related memberships.'),
a36434b9 428 'where' => 'civicrm_membership_type.max_related',
522a26c9 429 'table_name' => 'civicrm_membership_type',
430 'entity' => 'MembershipType',
431 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 432 'localizable' => 0,
6f85d058 433 'html' => [
434 'type' => 'Text',
4361de53 435 'label' => ts("Max Related"),
6f85d058 436 ],
c3fc2621
CW
437 ],
438 'visibility' => [
e501603b
TO
439 'name' => 'visibility',
440 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 441 'title' => ts('Visible'),
e501603b
TO
442 'maxlength' => 64,
443 'size' => CRM_Utils_Type::BIG,
a36434b9 444 'where' => 'civicrm_membership_type.visibility',
522a26c9 445 'table_name' => 'civicrm_membership_type',
446 'entity' => 'MembershipType',
447 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 448 'localizable' => 0,
c3fc2621 449 'html' => [
e501603b 450 'type' => 'Select',
c3fc2621
CW
451 ],
452 'pseudoconstant' => [
e501603b 453 'callback' => 'CRM_Core_SelectValues::memberVisibility',
e6ca0a57 454 ],
c3fc2621
CW
455 ],
456 'weight' => [
e501603b
TO
457 'name' => 'weight',
458 'type' => CRM_Utils_Type::T_INT,
c3fc2621 459 'title' => ts('Order'),
a36434b9 460 'where' => 'civicrm_membership_type.weight',
522a26c9 461 'table_name' => 'civicrm_membership_type',
462 'entity' => 'MembershipType',
463 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 464 'localizable' => 0,
6f85d058 465 'html' => [
466 'type' => 'Text',
467 ],
c3fc2621
CW
468 ],
469 'receipt_text_signup' => [
e501603b
TO
470 'name' => 'receipt_text_signup',
471 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 472 'title' => ts('Membership Type Receipt Text'),
215b423e 473 'description' => ts('Receipt Text for membership signup'),
e501603b
TO
474 'maxlength' => 255,
475 'size' => CRM_Utils_Type::HUGE,
a36434b9 476 'where' => 'civicrm_membership_type.receipt_text_signup',
522a26c9 477 'table_name' => 'civicrm_membership_type',
478 'entity' => 'MembershipType',
479 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 480 'localizable' => 0,
c3fc2621 481 'html' => [
e501603b 482 'type' => 'TextArea',
c3fc2621
CW
483 ],
484 ],
485 'receipt_text_renewal' => [
e501603b
TO
486 'name' => 'receipt_text_renewal',
487 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 488 'title' => ts('Membership Type Renewal Text'),
215b423e 489 'description' => ts('Receipt Text for membership renewal'),
e501603b
TO
490 'maxlength' => 255,
491 'size' => CRM_Utils_Type::HUGE,
a36434b9 492 'where' => 'civicrm_membership_type.receipt_text_renewal',
522a26c9 493 'table_name' => 'civicrm_membership_type',
494 'entity' => 'MembershipType',
495 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 496 'localizable' => 0,
c3fc2621 497 'html' => [
e501603b 498 'type' => 'TextArea',
c3fc2621
CW
499 ],
500 ],
501 'auto_renew' => [
e501603b
TO
502 'name' => 'auto_renew',
503 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 504 'title' => ts('Auto Renew'),
215b423e 505 'description' => ts('0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;'),
a36434b9 506 'where' => 'civicrm_membership_type.auto_renew',
45a83e42 507 'default' => '0',
522a26c9 508 'table_name' => 'civicrm_membership_type',
509 'entity' => 'MembershipType',
510 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 511 'localizable' => 0,
fc093e40 512 'html' => [
513 'type' => 'Radio',
514 ],
c3fc2621 515 'pseudoconstant' => [
e501603b 516 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
e6ca0a57 517 ],
c3fc2621
CW
518 ],
519 'is_active' => [
e501603b
TO
520 'name' => 'is_active',
521 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 522 'title' => ts('Is Active'),
215b423e 523 'description' => ts('Is this membership_type enabled'),
a36434b9 524 'where' => 'civicrm_membership_type.is_active',
e501603b 525 'default' => '1',
522a26c9 526 'table_name' => 'civicrm_membership_type',
527 'entity' => 'MembershipType',
528 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 529 'localizable' => 0,
6f85d058 530 'html' => [
531 'type' => 'CheckBox',
4361de53 532 'label' => ts("Enabled?"),
6f85d058 533 ],
c3fc2621
CW
534 ],
535 ];
346aaaba 536 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 537 }
346aaaba 538 return Civi::$statics[__CLASS__]['fields'];
e501603b 539 }
c3fc2621 540
e501603b 541 /**
bd8e0b14 542 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
543 *
544 * @return array
bd8e0b14 545 * Array(string $name => string $uniqueName).
e501603b 546 */
c3fc2621 547 public static function &fieldKeys() {
bd8e0b14
TO
548 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
549 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 550 }
bd8e0b14 551 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 552 }
c3fc2621 553
e501603b
TO
554 /**
555 * Returns the names of this table
556 *
557 * @return string
558 */
c3fc2621 559 public static function getTableName() {
e501603b
TO
560 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
561 }
c3fc2621 562
e501603b
TO
563 /**
564 * Returns if this table needs to be logged
565 *
c3fc2621 566 * @return bool
e501603b 567 */
c3fc2621 568 public function getLog() {
e501603b
TO
569 return self::$_log;
570 }
c3fc2621 571
e501603b
TO
572 /**
573 * Returns the list of fields that can be imported
574 *
575 * @param bool $prefix
576 *
577 * @return array
578 */
c3fc2621
CW
579 public static function &import($prefix = FALSE) {
580 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_type', $prefix, []);
60808919 581 return $r;
e501603b 582 }
c3fc2621 583
e501603b
TO
584 /**
585 * Returns the list of fields that can be exported
586 *
587 * @param bool $prefix
588 *
589 * @return array
590 */
c3fc2621
CW
591 public static function &export($prefix = FALSE) {
592 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_type', $prefix, []);
60808919 593 return $r;
e501603b 594 }
c3fc2621 595
e7a6b91a
AS
596 /**
597 * Returns the list of indices
c3fc2621
CW
598 *
599 * @param bool $localize
600 *
601 * @return array
e7a6b91a
AS
602 */
603 public static function indices($localize = TRUE) {
c3fc2621
CW
604 $indices = [
605 'index_relationship_type_id' => [
e7a6b91a 606 'name' => 'index_relationship_type_id',
c3fc2621 607 'field' => [
e7a6b91a 608 0 => 'relationship_type_id',
c3fc2621
CW
609 ],
610 'localizable' => FALSE,
e7a6b91a 611 'sig' => 'civicrm_membership_type::0::relationship_type_id',
c3fc2621
CW
612 ],
613 ];
e7a6b91a
AS
614 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
615 }
c3fc2621 616
e501603b 617}