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:713057d2c1a6dcb6cbd6449b8934d28c)
13 * Database access object for the MembershipType entity.
15 class CRM_Member_DAO_MembershipType
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.5';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_membership_type';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
41 * Which Domain is this match entry for
48 * Name of Membership Type
55 * Description of Membership Type
62 * Owner organization for this membership type. FK to Contact ID
66 public $member_of_contact_id;
69 * If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id
73 public $financial_type_id;
76 * Minimum fee for this membership (0 for free/complimentary memberships).
83 * Unit in which membership period is expressed.
87 public $duration_unit;
90 * Number of duration units in membership period (e.g. 1 year, 12 months).
94 public $duration_interval;
97 * Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.
104 * For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.
108 public $fixed_period_start_day;
111 * For fixed period memberships, signups after this day (mmdd) rollover to next period.
115 public $fixed_period_rollover_day;
118 * FK to Relationship Type ID
122 public $relationship_type_id;
127 public $relationship_direction;
130 * Maximum number of related memberships.
147 * Receipt Text for membership signup
151 public $receipt_text_signup;
154 * Receipt Text for membership renewal
158 public $receipt_text_renewal;
161 * 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;
168 * Is this membership_type enabled
177 public function __construct() {
178 $this->__table
= 'civicrm_membership_type';
179 parent
::__construct();
183 * Returns localized title of this entity.
185 public static function getEntityTitle() {
186 return ts('Membership Types');
190 * Returns foreign keys and entity references.
193 * [CRM_Core_Reference_Interface]
195 public static function getReferenceColumns() {
196 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
197 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
198 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
199 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'member_of_contact_id', 'civicrm_contact', 'id');
200 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
201 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
203 return Civi
::$statics[__CLASS__
]['links'];
207 * Returns all the column names of this table
211 public static function &fields() {
212 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
213 Civi
::$statics[__CLASS__
]['fields'] = [
216 'type' => CRM_Utils_Type
::T_INT
,
217 'title' => ts('Membership Type ID'),
218 'description' => ts('Membership Id'),
220 'where' => 'civicrm_membership_type.id',
221 'table_name' => 'civicrm_membership_type',
222 'entity' => 'MembershipType',
223 'bao' => 'CRM_Member_BAO_MembershipType',
228 'name' => 'domain_id',
229 'type' => CRM_Utils_Type
::T_INT
,
230 'title' => ts('Membership Type Domain'),
231 'description' => ts('Which Domain is this match entry for'),
233 'where' => 'civicrm_membership_type.domain_id',
234 'table_name' => 'civicrm_membership_type',
235 'entity' => 'MembershipType',
236 'bao' => 'CRM_Member_BAO_MembershipType',
238 'FKClassName' => 'CRM_Core_DAO_Domain',
239 'pseudoconstant' => [
240 'table' => 'civicrm_domain',
242 'labelColumn' => 'name',
246 'membership_type' => [
248 'type' => CRM_Utils_Type
::T_STRING
,
249 'title' => ts('Membership Type'),
250 'description' => ts('Name of Membership Type'),
253 'size' => CRM_Utils_Type
::HUGE
,
255 'where' => 'civicrm_membership_type.name',
257 'table_name' => 'civicrm_membership_type',
258 'entity' => 'MembershipType',
259 'bao' => 'CRM_Member_BAO_MembershipType',
263 'label' => ts("Name"),
268 'name' => 'description',
269 'type' => CRM_Utils_Type
::T_STRING
,
270 'title' => ts('Membership Type Description'),
271 'description' => ts('Description of Membership Type'),
273 'size' => CRM_Utils_Type
::HUGE
,
274 'where' => 'civicrm_membership_type.description',
275 'table_name' => 'civicrm_membership_type',
276 'entity' => 'MembershipType',
277 'bao' => 'CRM_Member_BAO_MembershipType',
280 'type' => 'TextArea',
281 'label' => ts("Description"),
285 'member_of_contact_id' => [
286 'name' => 'member_of_contact_id',
287 'type' => CRM_Utils_Type
::T_INT
,
288 'title' => ts('Membership Type Organization'),
289 'description' => ts('Owner organization for this membership type. FK to Contact ID'),
291 'where' => 'civicrm_membership_type.member_of_contact_id',
292 'table_name' => 'civicrm_membership_type',
293 'entity' => 'MembershipType',
294 'bao' => 'CRM_Member_BAO_MembershipType',
296 'FKClassName' => 'CRM_Contact_DAO_Contact',
299 'financial_type_id' => [
300 'name' => 'financial_type_id',
301 'type' => CRM_Utils_Type
::T_INT
,
302 'title' => ts('Membership Financial Type'),
303 'description' => ts('If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id'),
305 'where' => 'civicrm_membership_type.financial_type_id',
306 'table_name' => 'civicrm_membership_type',
307 'entity' => 'MembershipType',
308 'bao' => 'CRM_Member_BAO_MembershipType',
310 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
311 'pseudoconstant' => [
312 'table' => 'civicrm_financial_type',
314 'labelColumn' => 'name',
319 'name' => 'minimum_fee',
320 'type' => CRM_Utils_Type
::T_MONEY
,
321 'title' => ts('Membership Type Minimum Fee'),
322 'description' => ts('Minimum fee for this membership (0 for free/complimentary memberships).'),
327 'where' => 'civicrm_membership_type.minimum_fee',
329 'table_name' => 'civicrm_membership_type',
330 'entity' => 'MembershipType',
331 'bao' => 'CRM_Member_BAO_MembershipType',
335 'label' => ts("Minimum Fee"),
340 'name' => 'duration_unit',
341 'type' => CRM_Utils_Type
::T_STRING
,
342 'title' => ts('Membership Type Duration Unit'),
343 'description' => ts('Unit in which membership period is expressed.'),
345 'size' => CRM_Utils_Type
::EIGHT
,
346 'where' => 'civicrm_membership_type.duration_unit',
347 'table_name' => 'civicrm_membership_type',
348 'entity' => 'MembershipType',
349 'bao' => 'CRM_Member_BAO_MembershipType',
354 'pseudoconstant' => [
355 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
359 'duration_interval' => [
360 'name' => 'duration_interval',
361 'type' => CRM_Utils_Type
::T_INT
,
362 'title' => ts('Membership Type Duration Interval'),
363 'description' => ts('Number of duration units in membership period (e.g. 1 year, 12 months).'),
364 'where' => 'civicrm_membership_type.duration_interval',
365 'table_name' => 'civicrm_membership_type',
366 'entity' => 'MembershipType',
367 'bao' => 'CRM_Member_BAO_MembershipType',
375 'name' => 'period_type',
376 'type' => CRM_Utils_Type
::T_STRING
,
377 'title' => ts('Membership Type Plan'),
378 'description' => ts('Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'),
380 'size' => CRM_Utils_Type
::EIGHT
,
381 'where' => 'civicrm_membership_type.period_type',
382 'table_name' => 'civicrm_membership_type',
383 'entity' => 'MembershipType',
384 'bao' => 'CRM_Member_BAO_MembershipType',
389 'pseudoconstant' => [
390 'callback' => 'CRM_Core_SelectValues::periodType',
394 'fixed_period_start_day' => [
395 'name' => 'fixed_period_start_day',
396 'type' => CRM_Utils_Type
::T_INT
,
397 'title' => ts('Fixed Period Start Day'),
398 '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.'),
399 'where' => 'civicrm_membership_type.fixed_period_start_day',
400 'table_name' => 'civicrm_membership_type',
401 'entity' => 'MembershipType',
402 'bao' => 'CRM_Member_BAO_MembershipType',
406 'fixed_period_rollover_day' => [
407 'name' => 'fixed_period_rollover_day',
408 'type' => CRM_Utils_Type
::T_INT
,
409 'title' => ts('Fixed Period Rollover Day'),
410 'description' => ts('For fixed period memberships, signups after this day (mmdd) rollover to next period.'),
411 'where' => 'civicrm_membership_type.fixed_period_rollover_day',
412 'table_name' => 'civicrm_membership_type',
413 'entity' => 'MembershipType',
414 'bao' => 'CRM_Member_BAO_MembershipType',
418 'relationship_type_id' => [
419 'name' => 'relationship_type_id',
420 'type' => CRM_Utils_Type
::T_STRING
,
421 'title' => ts('Membership Type Relationship'),
422 'description' => ts('FK to Relationship Type ID'),
424 'size' => CRM_Utils_Type
::BIG
,
425 'where' => 'civicrm_membership_type.relationship_type_id',
426 'table_name' => 'civicrm_membership_type',
427 'entity' => 'MembershipType',
428 'bao' => 'CRM_Member_BAO_MembershipType',
430 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
433 'relationship_direction' => [
434 'name' => 'relationship_direction',
435 'type' => CRM_Utils_Type
::T_STRING
,
436 'title' => ts('Relationship Direction'),
438 'size' => CRM_Utils_Type
::HUGE
,
439 'where' => 'civicrm_membership_type.relationship_direction',
440 'table_name' => 'civicrm_membership_type',
441 'entity' => 'MembershipType',
442 'bao' => 'CRM_Member_BAO_MembershipType',
444 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
448 'name' => 'max_related',
449 'type' => CRM_Utils_Type
::T_INT
,
450 'title' => ts('Max Related Members for Type'),
451 'description' => ts('Maximum number of related memberships.'),
452 'where' => 'civicrm_membership_type.max_related',
453 'table_name' => 'civicrm_membership_type',
454 'entity' => 'MembershipType',
455 'bao' => 'CRM_Member_BAO_MembershipType',
459 'label' => ts("Max Related"),
464 'name' => 'visibility',
465 'type' => CRM_Utils_Type
::T_STRING
,
466 'title' => ts('Visible'),
468 'size' => CRM_Utils_Type
::BIG
,
469 'where' => 'civicrm_membership_type.visibility',
470 'table_name' => 'civicrm_membership_type',
471 'entity' => 'MembershipType',
472 'bao' => 'CRM_Member_BAO_MembershipType',
477 'pseudoconstant' => [
478 'callback' => 'CRM_Core_SelectValues::memberVisibility',
484 'type' => CRM_Utils_Type
::T_INT
,
485 'title' => ts('Order'),
486 'where' => 'civicrm_membership_type.weight',
487 'table_name' => 'civicrm_membership_type',
488 'entity' => 'MembershipType',
489 'bao' => 'CRM_Member_BAO_MembershipType',
496 'receipt_text_signup' => [
497 'name' => 'receipt_text_signup',
498 'type' => CRM_Utils_Type
::T_STRING
,
499 'title' => ts('Membership Type Receipt Text'),
500 'description' => ts('Receipt Text for membership signup'),
502 'size' => CRM_Utils_Type
::HUGE
,
503 'where' => 'civicrm_membership_type.receipt_text_signup',
504 'table_name' => 'civicrm_membership_type',
505 'entity' => 'MembershipType',
506 'bao' => 'CRM_Member_BAO_MembershipType',
509 'type' => 'TextArea',
513 'receipt_text_renewal' => [
514 'name' => 'receipt_text_renewal',
515 'type' => CRM_Utils_Type
::T_STRING
,
516 'title' => ts('Membership Type Renewal Text'),
517 'description' => ts('Receipt Text for membership renewal'),
519 'size' => CRM_Utils_Type
::HUGE
,
520 'where' => 'civicrm_membership_type.receipt_text_renewal',
521 'table_name' => 'civicrm_membership_type',
522 'entity' => 'MembershipType',
523 'bao' => 'CRM_Member_BAO_MembershipType',
526 'type' => 'TextArea',
531 'name' => 'auto_renew',
532 'type' => CRM_Utils_Type
::T_BOOLEAN
,
533 'title' => ts('Auto Renew'),
534 'description' => ts('0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;'),
535 'where' => 'civicrm_membership_type.auto_renew',
537 'table_name' => 'civicrm_membership_type',
538 'entity' => 'MembershipType',
539 'bao' => 'CRM_Member_BAO_MembershipType',
544 'pseudoconstant' => [
545 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
550 'name' => 'is_active',
551 'type' => CRM_Utils_Type
::T_BOOLEAN
,
552 'title' => ts('Is Active'),
553 'description' => ts('Is this membership_type enabled'),
554 'where' => 'civicrm_membership_type.is_active',
556 'table_name' => 'civicrm_membership_type',
557 'entity' => 'MembershipType',
558 'bao' => 'CRM_Member_BAO_MembershipType',
561 'type' => 'CheckBox',
562 'label' => ts("Enabled?"),
567 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
569 return Civi
::$statics[__CLASS__
]['fields'];
573 * Return a mapping from field-name to the corresponding key (as used in fields()).
576 * Array(string $name => string $uniqueName).
578 public static function &fieldKeys() {
579 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
580 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
582 return Civi
::$statics[__CLASS__
]['fieldKeys'];
586 * Returns the names of this table
590 public static function getTableName() {
591 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
595 * Returns if this table needs to be logged
599 public function getLog() {
604 * Returns the list of fields that can be imported
606 * @param bool $prefix
610 public static function &import($prefix = FALSE) {
611 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, []);
616 * Returns the list of fields that can be exported
618 * @param bool $prefix
622 public static function &export($prefix = FALSE) {
623 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, []);
628 * Returns the list of indices
630 * @param bool $localize
634 public static function indices($localize = TRUE) {
636 'index_relationship_type_id' => [
637 'name' => 'index_relationship_type_id',
639 0 => 'relationship_type_id',
641 'localizable' => FALSE,
642 'sig' => 'civicrm_membership_type::0::relationship_type_id',
645 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;