5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Member/MembershipType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:c75161ef1844cf9a3977d458f0cb515b)
13 * Database access object for the MembershipType entity.
15 class CRM_Member_DAO_MembershipType
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_membership_type';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * Which Domain is this match entry for
46 * Name of Membership Type
53 * Description of Membership Type
60 * Owner organization for this membership type. FK to Contact ID
64 public $member_of_contact_id;
67 * If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id
71 public $financial_type_id;
74 * Minimum fee for this membership (0 for free/complimentary memberships).
81 * Unit in which membership period is expressed.
85 public $duration_unit;
88 * Number of duration units in membership period (e.g. 1 year, 12 months).
92 public $duration_interval;
95 * Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.
102 * For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.
106 public $fixed_period_start_day;
109 * For fixed period memberships, signups after this day (mmdd) rollover to next period.
113 public $fixed_period_rollover_day;
116 * FK to Relationship Type ID
120 public $relationship_type_id;
125 public $relationship_direction;
128 * Maximum number of related memberships.
145 * Receipt Text for membership signup
149 public $receipt_text_signup;
152 * Receipt Text for membership renewal
156 public $receipt_text_renewal;
159 * 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;
166 * Is this membership_type enabled
175 public function __construct() {
176 $this->__table
= 'civicrm_membership_type';
177 parent
::__construct();
181 * Returns foreign keys and entity references.
184 * [CRM_Core_Reference_Interface]
186 public static function getReferenceColumns() {
187 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
188 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
192 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
194 return Civi
::$statics[__CLASS__
]['links'];
198 * Returns all the column names of this table
202 public static function &fields() {
203 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
204 Civi
::$statics[__CLASS__
]['fields'] = [
207 'type' => CRM_Utils_Type
::T_INT
,
208 'title' => ts('Membership Type ID'),
209 'description' => ts('Membership Id'),
211 'where' => 'civicrm_membership_type.id',
212 'table_name' => 'civicrm_membership_type',
213 'entity' => 'MembershipType',
214 'bao' => 'CRM_Member_BAO_MembershipType',
218 'name' => 'domain_id',
219 'type' => CRM_Utils_Type
::T_INT
,
220 'title' => ts('Membership Type Domain'),
221 'description' => ts('Which Domain is this match entry for'),
223 'where' => 'civicrm_membership_type.domain_id',
224 'table_name' => 'civicrm_membership_type',
225 'entity' => 'MembershipType',
226 'bao' => 'CRM_Member_BAO_MembershipType',
228 'FKClassName' => 'CRM_Core_DAO_Domain',
229 'pseudoconstant' => [
230 'table' => 'civicrm_domain',
232 'labelColumn' => 'name',
235 'membership_type' => [
237 'type' => CRM_Utils_Type
::T_STRING
,
238 'title' => ts('Membership Type'),
239 'description' => ts('Name of Membership Type'),
242 'size' => CRM_Utils_Type
::HUGE
,
244 'where' => 'civicrm_membership_type.name',
246 'table_name' => 'civicrm_membership_type',
247 'entity' => 'MembershipType',
248 'bao' => 'CRM_Member_BAO_MembershipType',
252 'label' => ts("Name"),
256 'name' => 'description',
257 'type' => CRM_Utils_Type
::T_STRING
,
258 'title' => ts('Membership Type Description'),
259 'description' => ts('Description of Membership Type'),
261 'size' => CRM_Utils_Type
::HUGE
,
262 'where' => 'civicrm_membership_type.description',
263 'table_name' => 'civicrm_membership_type',
264 'entity' => 'MembershipType',
265 'bao' => 'CRM_Member_BAO_MembershipType',
268 'type' => 'TextArea',
269 'label' => ts("Description"),
272 'member_of_contact_id' => [
273 'name' => 'member_of_contact_id',
274 'type' => CRM_Utils_Type
::T_INT
,
275 'title' => ts('Membership Type Organization'),
276 'description' => ts('Owner organization for this membership type. FK to Contact ID'),
278 'where' => 'civicrm_membership_type.member_of_contact_id',
279 'table_name' => 'civicrm_membership_type',
280 'entity' => 'MembershipType',
281 'bao' => 'CRM_Member_BAO_MembershipType',
283 'FKClassName' => 'CRM_Contact_DAO_Contact',
285 'financial_type_id' => [
286 'name' => 'financial_type_id',
287 'type' => CRM_Utils_Type
::T_INT
,
288 'title' => ts('Membership Financial Type'),
289 'description' => ts('If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id'),
291 'where' => 'civicrm_membership_type.financial_type_id',
292 'table_name' => 'civicrm_membership_type',
293 'entity' => 'MembershipType',
294 'bao' => 'CRM_Member_BAO_MembershipType',
296 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
297 'pseudoconstant' => [
298 'table' => 'civicrm_financial_type',
300 'labelColumn' => 'name',
304 'name' => 'minimum_fee',
305 'type' => CRM_Utils_Type
::T_MONEY
,
306 'title' => ts('Membership Type Minimum Fee'),
307 'description' => ts('Minimum fee for this membership (0 for free/complimentary memberships).'),
312 'where' => 'civicrm_membership_type.minimum_fee',
314 'table_name' => 'civicrm_membership_type',
315 'entity' => 'MembershipType',
316 'bao' => 'CRM_Member_BAO_MembershipType',
320 'label' => ts("Minimum Fee"),
324 'name' => 'duration_unit',
325 'type' => CRM_Utils_Type
::T_STRING
,
326 'title' => ts('Membership Type Duration Unit'),
327 'description' => ts('Unit in which membership period is expressed.'),
329 'size' => CRM_Utils_Type
::EIGHT
,
330 'where' => 'civicrm_membership_type.duration_unit',
331 'table_name' => 'civicrm_membership_type',
332 'entity' => 'MembershipType',
333 'bao' => 'CRM_Member_BAO_MembershipType',
338 'pseudoconstant' => [
339 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
342 'duration_interval' => [
343 'name' => 'duration_interval',
344 'type' => CRM_Utils_Type
::T_INT
,
345 'title' => ts('Membership Type Duration Interval'),
346 'description' => ts('Number of duration units in membership period (e.g. 1 year, 12 months).'),
347 'where' => 'civicrm_membership_type.duration_interval',
348 'table_name' => 'civicrm_membership_type',
349 'entity' => 'MembershipType',
350 'bao' => 'CRM_Member_BAO_MembershipType',
357 'name' => 'period_type',
358 'type' => CRM_Utils_Type
::T_STRING
,
359 'title' => ts('Membership Type Plan'),
360 'description' => ts('Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'),
362 'size' => CRM_Utils_Type
::EIGHT
,
363 'where' => 'civicrm_membership_type.period_type',
364 'table_name' => 'civicrm_membership_type',
365 'entity' => 'MembershipType',
366 'bao' => 'CRM_Member_BAO_MembershipType',
371 'pseudoconstant' => [
372 'callback' => 'CRM_Core_SelectValues::periodType',
375 'fixed_period_start_day' => [
376 'name' => 'fixed_period_start_day',
377 'type' => CRM_Utils_Type
::T_INT
,
378 'title' => ts('Fixed Period Start Day'),
379 '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.'),
380 'where' => 'civicrm_membership_type.fixed_period_start_day',
381 'table_name' => 'civicrm_membership_type',
382 'entity' => 'MembershipType',
383 'bao' => 'CRM_Member_BAO_MembershipType',
386 'fixed_period_rollover_day' => [
387 'name' => 'fixed_period_rollover_day',
388 'type' => CRM_Utils_Type
::T_INT
,
389 'title' => ts('Fixed Period Rollover Day'),
390 'description' => ts('For fixed period memberships, signups after this day (mmdd) rollover to next period.'),
391 'where' => 'civicrm_membership_type.fixed_period_rollover_day',
392 'table_name' => 'civicrm_membership_type',
393 'entity' => 'MembershipType',
394 'bao' => 'CRM_Member_BAO_MembershipType',
397 'relationship_type_id' => [
398 'name' => 'relationship_type_id',
399 'type' => CRM_Utils_Type
::T_STRING
,
400 'title' => ts('Membership Type Relationship'),
401 'description' => ts('FK to Relationship Type ID'),
403 'size' => CRM_Utils_Type
::BIG
,
404 'where' => 'civicrm_membership_type.relationship_type_id',
405 'table_name' => 'civicrm_membership_type',
406 'entity' => 'MembershipType',
407 'bao' => 'CRM_Member_BAO_MembershipType',
409 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
411 'relationship_direction' => [
412 'name' => 'relationship_direction',
413 'type' => CRM_Utils_Type
::T_STRING
,
414 'title' => ts('Relationship Direction'),
416 'size' => CRM_Utils_Type
::HUGE
,
417 'where' => 'civicrm_membership_type.relationship_direction',
418 'table_name' => 'civicrm_membership_type',
419 'entity' => 'MembershipType',
420 'bao' => 'CRM_Member_BAO_MembershipType',
422 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
425 'name' => 'max_related',
426 'type' => CRM_Utils_Type
::T_INT
,
427 'title' => ts('Max Related Members for Type'),
428 'description' => ts('Maximum number of related memberships.'),
429 'where' => 'civicrm_membership_type.max_related',
430 'table_name' => 'civicrm_membership_type',
431 'entity' => 'MembershipType',
432 'bao' => 'CRM_Member_BAO_MembershipType',
436 'label' => ts("Max Related"),
440 'name' => 'visibility',
441 'type' => CRM_Utils_Type
::T_STRING
,
442 'title' => ts('Visible'),
444 'size' => CRM_Utils_Type
::BIG
,
445 'where' => 'civicrm_membership_type.visibility',
446 'table_name' => 'civicrm_membership_type',
447 'entity' => 'MembershipType',
448 'bao' => 'CRM_Member_BAO_MembershipType',
453 'pseudoconstant' => [
454 'callback' => 'CRM_Core_SelectValues::memberVisibility',
459 'type' => CRM_Utils_Type
::T_INT
,
460 'title' => ts('Order'),
461 'where' => 'civicrm_membership_type.weight',
462 'table_name' => 'civicrm_membership_type',
463 'entity' => 'MembershipType',
464 'bao' => 'CRM_Member_BAO_MembershipType',
470 'receipt_text_signup' => [
471 'name' => 'receipt_text_signup',
472 'type' => CRM_Utils_Type
::T_STRING
,
473 'title' => ts('Membership Type Receipt Text'),
474 'description' => ts('Receipt Text for membership signup'),
476 'size' => CRM_Utils_Type
::HUGE
,
477 'where' => 'civicrm_membership_type.receipt_text_signup',
478 'table_name' => 'civicrm_membership_type',
479 'entity' => 'MembershipType',
480 'bao' => 'CRM_Member_BAO_MembershipType',
483 'type' => 'TextArea',
486 'receipt_text_renewal' => [
487 'name' => 'receipt_text_renewal',
488 'type' => CRM_Utils_Type
::T_STRING
,
489 'title' => ts('Membership Type Renewal Text'),
490 'description' => ts('Receipt Text for membership renewal'),
492 'size' => CRM_Utils_Type
::HUGE
,
493 'where' => 'civicrm_membership_type.receipt_text_renewal',
494 'table_name' => 'civicrm_membership_type',
495 'entity' => 'MembershipType',
496 'bao' => 'CRM_Member_BAO_MembershipType',
499 'type' => 'TextArea',
503 'name' => 'auto_renew',
504 'type' => CRM_Utils_Type
::T_BOOLEAN
,
505 'title' => ts('Auto Renew'),
506 'description' => ts('0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;'),
507 'where' => 'civicrm_membership_type.auto_renew',
509 'table_name' => 'civicrm_membership_type',
510 'entity' => 'MembershipType',
511 'bao' => 'CRM_Member_BAO_MembershipType',
516 'pseudoconstant' => [
517 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
521 'name' => 'is_active',
522 'type' => CRM_Utils_Type
::T_BOOLEAN
,
523 'title' => ts('Is Active'),
524 'description' => ts('Is this membership_type enabled'),
525 'where' => 'civicrm_membership_type.is_active',
527 'table_name' => 'civicrm_membership_type',
528 'entity' => 'MembershipType',
529 'bao' => 'CRM_Member_BAO_MembershipType',
532 'type' => 'CheckBox',
533 'label' => ts("Enabled?"),
537 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
539 return Civi
::$statics[__CLASS__
]['fields'];
543 * Return a mapping from field-name to the corresponding key (as used in fields()).
546 * Array(string $name => string $uniqueName).
548 public static function &fieldKeys() {
549 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
550 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
552 return Civi
::$statics[__CLASS__
]['fieldKeys'];
556 * Returns the names of this table
560 public static function getTableName() {
561 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
565 * Returns if this table needs to be logged
569 public function getLog() {
574 * Returns the list of fields that can be imported
576 * @param bool $prefix
580 public static function &import($prefix = FALSE) {
581 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, []);
586 * Returns the list of fields that can be exported
588 * @param bool $prefix
592 public static function &export($prefix = FALSE) {
593 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, []);
598 * Returns the list of indices
600 * @param bool $localize
604 public static function indices($localize = TRUE) {
606 'index_relationship_type_id' => [
607 'name' => 'index_relationship_type_id',
609 0 => 'relationship_type_id',
611 'localizable' => FALSE,
612 'sig' => 'civicrm_membership_type::0::relationship_type_id',
615 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;