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:db300e3a7f5ca29a1b6ca43e0885bcb5)
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 * @param bool $plural
186 * Whether to return the plural version of the title.
188 public static function getEntityTitle($plural = FALSE) {
189 return $plural ?
ts('Membership Types') : ts('Membership Type');
193 * Returns foreign keys and entity references.
196 * [CRM_Core_Reference_Interface]
198 public static function getReferenceColumns() {
199 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
200 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
201 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
202 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'member_of_contact_id', 'civicrm_contact', 'id');
203 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
204 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
206 return Civi
::$statics[__CLASS__
]['links'];
210 * Returns all the column names of this table
214 public static function &fields() {
215 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
216 Civi
::$statics[__CLASS__
]['fields'] = [
219 'type' => CRM_Utils_Type
::T_INT
,
220 'title' => ts('Membership Type ID'),
221 'description' => ts('Membership Id'),
223 'where' => 'civicrm_membership_type.id',
224 'table_name' => 'civicrm_membership_type',
225 'entity' => 'MembershipType',
226 'bao' => 'CRM_Member_BAO_MembershipType',
231 'name' => 'domain_id',
232 'type' => CRM_Utils_Type
::T_INT
,
233 'title' => ts('Membership Type Domain'),
234 'description' => ts('Which Domain is this match entry for'),
236 'where' => 'civicrm_membership_type.domain_id',
237 'table_name' => 'civicrm_membership_type',
238 'entity' => 'MembershipType',
239 'bao' => 'CRM_Member_BAO_MembershipType',
241 'FKClassName' => 'CRM_Core_DAO_Domain',
242 'pseudoconstant' => [
243 'table' => 'civicrm_domain',
245 'labelColumn' => 'name',
249 'membership_type' => [
251 'type' => CRM_Utils_Type
::T_STRING
,
252 'title' => ts('Membership Type'),
253 'description' => ts('Name of Membership Type'),
256 'size' => CRM_Utils_Type
::HUGE
,
258 'where' => 'civicrm_membership_type.name',
260 'table_name' => 'civicrm_membership_type',
261 'entity' => 'MembershipType',
262 'bao' => 'CRM_Member_BAO_MembershipType',
266 'label' => ts("Name"),
271 'name' => 'description',
272 'type' => CRM_Utils_Type
::T_STRING
,
273 'title' => ts('Membership Type Description'),
274 'description' => ts('Description of Membership Type'),
276 'size' => CRM_Utils_Type
::HUGE
,
277 'where' => 'civicrm_membership_type.description',
278 'table_name' => 'civicrm_membership_type',
279 'entity' => 'MembershipType',
280 'bao' => 'CRM_Member_BAO_MembershipType',
283 'type' => 'TextArea',
284 'label' => ts("Description"),
288 'member_of_contact_id' => [
289 'name' => 'member_of_contact_id',
290 'type' => CRM_Utils_Type
::T_INT
,
291 'title' => ts('Membership Type Organization'),
292 'description' => ts('Owner organization for this membership type. FK to Contact ID'),
294 'where' => 'civicrm_membership_type.member_of_contact_id',
295 'table_name' => 'civicrm_membership_type',
296 'entity' => 'MembershipType',
297 'bao' => 'CRM_Member_BAO_MembershipType',
299 'FKClassName' => 'CRM_Contact_DAO_Contact',
302 'financial_type_id' => [
303 'name' => 'financial_type_id',
304 'type' => CRM_Utils_Type
::T_INT
,
305 'title' => ts('Membership Financial Type'),
306 'description' => ts('If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id'),
308 'where' => 'civicrm_membership_type.financial_type_id',
309 'table_name' => 'civicrm_membership_type',
310 'entity' => 'MembershipType',
311 'bao' => 'CRM_Member_BAO_MembershipType',
313 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
314 'pseudoconstant' => [
315 'table' => 'civicrm_financial_type',
317 'labelColumn' => 'name',
322 'name' => 'minimum_fee',
323 'type' => CRM_Utils_Type
::T_MONEY
,
324 'title' => ts('Membership Type Minimum Fee'),
325 'description' => ts('Minimum fee for this membership (0 for free/complimentary memberships).'),
330 'where' => 'civicrm_membership_type.minimum_fee',
332 'table_name' => 'civicrm_membership_type',
333 'entity' => 'MembershipType',
334 'bao' => 'CRM_Member_BAO_MembershipType',
338 'label' => ts("Minimum Fee"),
343 'name' => 'duration_unit',
344 'type' => CRM_Utils_Type
::T_STRING
,
345 'title' => ts('Membership Type Duration Unit'),
346 'description' => ts('Unit in which membership period is expressed.'),
348 'size' => CRM_Utils_Type
::EIGHT
,
349 'where' => 'civicrm_membership_type.duration_unit',
350 'table_name' => 'civicrm_membership_type',
351 'entity' => 'MembershipType',
352 'bao' => 'CRM_Member_BAO_MembershipType',
357 'pseudoconstant' => [
358 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
362 'duration_interval' => [
363 'name' => 'duration_interval',
364 'type' => CRM_Utils_Type
::T_INT
,
365 'title' => ts('Membership Type Duration Interval'),
366 'description' => ts('Number of duration units in membership period (e.g. 1 year, 12 months).'),
367 'where' => 'civicrm_membership_type.duration_interval',
368 'table_name' => 'civicrm_membership_type',
369 'entity' => 'MembershipType',
370 'bao' => 'CRM_Member_BAO_MembershipType',
378 'name' => 'period_type',
379 'type' => CRM_Utils_Type
::T_STRING
,
380 'title' => ts('Membership Type Plan'),
381 'description' => ts('Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'),
384 'size' => CRM_Utils_Type
::EIGHT
,
385 'where' => 'civicrm_membership_type.period_type',
386 'table_name' => 'civicrm_membership_type',
387 'entity' => 'MembershipType',
388 'bao' => 'CRM_Member_BAO_MembershipType',
393 'pseudoconstant' => [
394 'callback' => 'CRM_Core_SelectValues::periodType',
398 'fixed_period_start_day' => [
399 'name' => 'fixed_period_start_day',
400 'type' => CRM_Utils_Type
::T_INT
,
401 'title' => ts('Fixed Period Start Day'),
402 '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.'),
403 'where' => 'civicrm_membership_type.fixed_period_start_day',
404 'table_name' => 'civicrm_membership_type',
405 'entity' => 'MembershipType',
406 'bao' => 'CRM_Member_BAO_MembershipType',
410 'fixed_period_rollover_day' => [
411 'name' => 'fixed_period_rollover_day',
412 'type' => CRM_Utils_Type
::T_INT
,
413 'title' => ts('Fixed Period Rollover Day'),
414 'description' => ts('For fixed period memberships, signups after this day (mmdd) rollover to next period.'),
415 'where' => 'civicrm_membership_type.fixed_period_rollover_day',
416 'table_name' => 'civicrm_membership_type',
417 'entity' => 'MembershipType',
418 'bao' => 'CRM_Member_BAO_MembershipType',
422 'relationship_type_id' => [
423 'name' => 'relationship_type_id',
424 'type' => CRM_Utils_Type
::T_STRING
,
425 'title' => ts('Membership Type Relationship'),
426 'description' => ts('FK to Relationship Type ID'),
428 'size' => CRM_Utils_Type
::BIG
,
429 'where' => 'civicrm_membership_type.relationship_type_id',
430 'table_name' => 'civicrm_membership_type',
431 'entity' => 'MembershipType',
432 'bao' => 'CRM_Member_BAO_MembershipType',
434 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
437 'relationship_direction' => [
438 'name' => 'relationship_direction',
439 'type' => CRM_Utils_Type
::T_STRING
,
440 'title' => ts('Relationship Direction'),
442 'size' => CRM_Utils_Type
::HUGE
,
443 'where' => 'civicrm_membership_type.relationship_direction',
444 'table_name' => 'civicrm_membership_type',
445 'entity' => 'MembershipType',
446 'bao' => 'CRM_Member_BAO_MembershipType',
448 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
452 'name' => 'max_related',
453 'type' => CRM_Utils_Type
::T_INT
,
454 'title' => ts('Max Related Members for Type'),
455 'description' => ts('Maximum number of related memberships.'),
456 'where' => 'civicrm_membership_type.max_related',
457 'table_name' => 'civicrm_membership_type',
458 'entity' => 'MembershipType',
459 'bao' => 'CRM_Member_BAO_MembershipType',
463 'label' => ts("Max Related"),
468 'name' => 'visibility',
469 'type' => CRM_Utils_Type
::T_STRING
,
470 'title' => ts('Visible'),
472 'size' => CRM_Utils_Type
::BIG
,
473 'where' => 'civicrm_membership_type.visibility',
474 'table_name' => 'civicrm_membership_type',
475 'entity' => 'MembershipType',
476 'bao' => 'CRM_Member_BAO_MembershipType',
481 'pseudoconstant' => [
482 'callback' => 'CRM_Core_SelectValues::memberVisibility',
488 'type' => CRM_Utils_Type
::T_INT
,
489 'title' => ts('Order'),
490 'where' => 'civicrm_membership_type.weight',
491 'table_name' => 'civicrm_membership_type',
492 'entity' => 'MembershipType',
493 'bao' => 'CRM_Member_BAO_MembershipType',
500 'receipt_text_signup' => [
501 'name' => 'receipt_text_signup',
502 'type' => CRM_Utils_Type
::T_STRING
,
503 'title' => ts('Membership Type Receipt Text'),
504 'description' => ts('Receipt Text for membership signup'),
506 'size' => CRM_Utils_Type
::HUGE
,
507 'where' => 'civicrm_membership_type.receipt_text_signup',
508 'table_name' => 'civicrm_membership_type',
509 'entity' => 'MembershipType',
510 'bao' => 'CRM_Member_BAO_MembershipType',
513 'type' => 'TextArea',
517 'receipt_text_renewal' => [
518 'name' => 'receipt_text_renewal',
519 'type' => CRM_Utils_Type
::T_STRING
,
520 'title' => ts('Membership Type Renewal Text'),
521 'description' => ts('Receipt Text for membership renewal'),
523 'size' => CRM_Utils_Type
::HUGE
,
524 'where' => 'civicrm_membership_type.receipt_text_renewal',
525 'table_name' => 'civicrm_membership_type',
526 'entity' => 'MembershipType',
527 'bao' => 'CRM_Member_BAO_MembershipType',
530 'type' => 'TextArea',
535 'name' => 'auto_renew',
536 'type' => CRM_Utils_Type
::T_BOOLEAN
,
537 'title' => ts('Auto Renew'),
538 'description' => ts('0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;'),
539 'where' => 'civicrm_membership_type.auto_renew',
541 'table_name' => 'civicrm_membership_type',
542 'entity' => 'MembershipType',
543 'bao' => 'CRM_Member_BAO_MembershipType',
548 'pseudoconstant' => [
549 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
554 'name' => 'is_active',
555 'type' => CRM_Utils_Type
::T_BOOLEAN
,
556 'title' => ts('Is Active'),
557 'description' => ts('Is this membership_type enabled'),
558 'where' => 'civicrm_membership_type.is_active',
560 'table_name' => 'civicrm_membership_type',
561 'entity' => 'MembershipType',
562 'bao' => 'CRM_Member_BAO_MembershipType',
565 'type' => 'CheckBox',
566 'label' => ts("Enabled?"),
571 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
573 return Civi
::$statics[__CLASS__
]['fields'];
577 * Return a mapping from field-name to the corresponding key (as used in fields()).
580 * Array(string $name => string $uniqueName).
582 public static function &fieldKeys() {
583 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
584 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
586 return Civi
::$statics[__CLASS__
]['fieldKeys'];
590 * Returns the names of this table
594 public static function getTableName() {
595 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
599 * Returns if this table needs to be logged
603 public function getLog() {
608 * Returns the list of fields that can be imported
610 * @param bool $prefix
614 public static function &import($prefix = FALSE) {
615 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, []);
620 * Returns the list of fields that can be exported
622 * @param bool $prefix
626 public static function &export($prefix = FALSE) {
627 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, []);
632 * Returns the list of indices
634 * @param bool $localize
638 public static function indices($localize = TRUE) {
640 'index_relationship_type_id' => [
641 'name' => 'index_relationship_type_id',
643 0 => 'relationship_type_id',
645 'localizable' => FALSE,
646 'sig' => 'civicrm_membership_type::0::relationship_type_id',
649 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;