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:f5bc2479f6a11bf6e573782d008ca262)
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 localized title of this entity.
183 public static function getEntityTitle() {
184 return ts('Membership Types');
188 * Returns foreign keys and entity references.
191 * [CRM_Core_Reference_Interface]
193 public static function getReferenceColumns() {
194 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
195 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
196 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
197 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'member_of_contact_id', 'civicrm_contact', 'id');
198 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'financial_type_id', 'civicrm_financial_type', 'id');
199 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
201 return Civi
::$statics[__CLASS__
]['links'];
205 * Returns all the column names of this table
209 public static function &fields() {
210 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
211 Civi
::$statics[__CLASS__
]['fields'] = [
214 'type' => CRM_Utils_Type
::T_INT
,
215 'title' => ts('Membership Type ID'),
216 'description' => ts('Membership Id'),
218 'where' => 'civicrm_membership_type.id',
219 'table_name' => 'civicrm_membership_type',
220 'entity' => 'MembershipType',
221 'bao' => 'CRM_Member_BAO_MembershipType',
225 'name' => 'domain_id',
226 'type' => CRM_Utils_Type
::T_INT
,
227 'title' => ts('Membership Type Domain'),
228 'description' => ts('Which Domain is this match entry for'),
230 'where' => 'civicrm_membership_type.domain_id',
231 'table_name' => 'civicrm_membership_type',
232 'entity' => 'MembershipType',
233 'bao' => 'CRM_Member_BAO_MembershipType',
235 'FKClassName' => 'CRM_Core_DAO_Domain',
236 'pseudoconstant' => [
237 'table' => 'civicrm_domain',
239 'labelColumn' => 'name',
242 'membership_type' => [
244 'type' => CRM_Utils_Type
::T_STRING
,
245 'title' => ts('Membership Type'),
246 'description' => ts('Name of Membership Type'),
249 'size' => CRM_Utils_Type
::HUGE
,
251 'where' => 'civicrm_membership_type.name',
253 'table_name' => 'civicrm_membership_type',
254 'entity' => 'MembershipType',
255 'bao' => 'CRM_Member_BAO_MembershipType',
259 'label' => ts("Name"),
263 'name' => 'description',
264 'type' => CRM_Utils_Type
::T_STRING
,
265 'title' => ts('Membership Type Description'),
266 'description' => ts('Description of Membership Type'),
268 'size' => CRM_Utils_Type
::HUGE
,
269 'where' => 'civicrm_membership_type.description',
270 'table_name' => 'civicrm_membership_type',
271 'entity' => 'MembershipType',
272 'bao' => 'CRM_Member_BAO_MembershipType',
275 'type' => 'TextArea',
276 'label' => ts("Description"),
279 'member_of_contact_id' => [
280 'name' => 'member_of_contact_id',
281 'type' => CRM_Utils_Type
::T_INT
,
282 'title' => ts('Membership Type Organization'),
283 'description' => ts('Owner organization for this membership type. FK to Contact ID'),
285 'where' => 'civicrm_membership_type.member_of_contact_id',
286 'table_name' => 'civicrm_membership_type',
287 'entity' => 'MembershipType',
288 'bao' => 'CRM_Member_BAO_MembershipType',
290 'FKClassName' => 'CRM_Contact_DAO_Contact',
292 'financial_type_id' => [
293 'name' => 'financial_type_id',
294 'type' => CRM_Utils_Type
::T_INT
,
295 'title' => ts('Membership Financial Type'),
296 'description' => ts('If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id'),
298 'where' => 'civicrm_membership_type.financial_type_id',
299 'table_name' => 'civicrm_membership_type',
300 'entity' => 'MembershipType',
301 'bao' => 'CRM_Member_BAO_MembershipType',
303 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
304 'pseudoconstant' => [
305 'table' => 'civicrm_financial_type',
307 'labelColumn' => 'name',
311 'name' => 'minimum_fee',
312 'type' => CRM_Utils_Type
::T_MONEY
,
313 'title' => ts('Membership Type Minimum Fee'),
314 'description' => ts('Minimum fee for this membership (0 for free/complimentary memberships).'),
319 'where' => 'civicrm_membership_type.minimum_fee',
321 'table_name' => 'civicrm_membership_type',
322 'entity' => 'MembershipType',
323 'bao' => 'CRM_Member_BAO_MembershipType',
327 'label' => ts("Minimum Fee"),
331 'name' => 'duration_unit',
332 'type' => CRM_Utils_Type
::T_STRING
,
333 'title' => ts('Membership Type Duration Unit'),
334 'description' => ts('Unit in which membership period is expressed.'),
336 'size' => CRM_Utils_Type
::EIGHT
,
337 'where' => 'civicrm_membership_type.duration_unit',
338 'table_name' => 'civicrm_membership_type',
339 'entity' => 'MembershipType',
340 'bao' => 'CRM_Member_BAO_MembershipType',
345 'pseudoconstant' => [
346 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
349 'duration_interval' => [
350 'name' => 'duration_interval',
351 'type' => CRM_Utils_Type
::T_INT
,
352 'title' => ts('Membership Type Duration Interval'),
353 'description' => ts('Number of duration units in membership period (e.g. 1 year, 12 months).'),
354 'where' => 'civicrm_membership_type.duration_interval',
355 'table_name' => 'civicrm_membership_type',
356 'entity' => 'MembershipType',
357 'bao' => 'CRM_Member_BAO_MembershipType',
364 'name' => 'period_type',
365 'type' => CRM_Utils_Type
::T_STRING
,
366 'title' => ts('Membership Type Plan'),
367 'description' => ts('Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'),
369 'size' => CRM_Utils_Type
::EIGHT
,
370 'where' => 'civicrm_membership_type.period_type',
371 'table_name' => 'civicrm_membership_type',
372 'entity' => 'MembershipType',
373 'bao' => 'CRM_Member_BAO_MembershipType',
378 'pseudoconstant' => [
379 'callback' => 'CRM_Core_SelectValues::periodType',
382 'fixed_period_start_day' => [
383 'name' => 'fixed_period_start_day',
384 'type' => CRM_Utils_Type
::T_INT
,
385 'title' => ts('Fixed Period Start Day'),
386 '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.'),
387 'where' => 'civicrm_membership_type.fixed_period_start_day',
388 'table_name' => 'civicrm_membership_type',
389 'entity' => 'MembershipType',
390 'bao' => 'CRM_Member_BAO_MembershipType',
393 'fixed_period_rollover_day' => [
394 'name' => 'fixed_period_rollover_day',
395 'type' => CRM_Utils_Type
::T_INT
,
396 'title' => ts('Fixed Period Rollover Day'),
397 'description' => ts('For fixed period memberships, signups after this day (mmdd) rollover to next period.'),
398 'where' => 'civicrm_membership_type.fixed_period_rollover_day',
399 'table_name' => 'civicrm_membership_type',
400 'entity' => 'MembershipType',
401 'bao' => 'CRM_Member_BAO_MembershipType',
404 'relationship_type_id' => [
405 'name' => 'relationship_type_id',
406 'type' => CRM_Utils_Type
::T_STRING
,
407 'title' => ts('Membership Type Relationship'),
408 'description' => ts('FK to Relationship Type ID'),
410 'size' => CRM_Utils_Type
::BIG
,
411 'where' => 'civicrm_membership_type.relationship_type_id',
412 'table_name' => 'civicrm_membership_type',
413 'entity' => 'MembershipType',
414 'bao' => 'CRM_Member_BAO_MembershipType',
416 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
418 'relationship_direction' => [
419 'name' => 'relationship_direction',
420 'type' => CRM_Utils_Type
::T_STRING
,
421 'title' => ts('Relationship Direction'),
423 'size' => CRM_Utils_Type
::HUGE
,
424 'where' => 'civicrm_membership_type.relationship_direction',
425 'table_name' => 'civicrm_membership_type',
426 'entity' => 'MembershipType',
427 'bao' => 'CRM_Member_BAO_MembershipType',
429 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
432 'name' => 'max_related',
433 'type' => CRM_Utils_Type
::T_INT
,
434 'title' => ts('Max Related Members for Type'),
435 'description' => ts('Maximum number of related memberships.'),
436 'where' => 'civicrm_membership_type.max_related',
437 'table_name' => 'civicrm_membership_type',
438 'entity' => 'MembershipType',
439 'bao' => 'CRM_Member_BAO_MembershipType',
443 'label' => ts("Max Related"),
447 'name' => 'visibility',
448 'type' => CRM_Utils_Type
::T_STRING
,
449 'title' => ts('Visible'),
451 'size' => CRM_Utils_Type
::BIG
,
452 'where' => 'civicrm_membership_type.visibility',
453 'table_name' => 'civicrm_membership_type',
454 'entity' => 'MembershipType',
455 'bao' => 'CRM_Member_BAO_MembershipType',
460 'pseudoconstant' => [
461 'callback' => 'CRM_Core_SelectValues::memberVisibility',
466 'type' => CRM_Utils_Type
::T_INT
,
467 'title' => ts('Order'),
468 'where' => 'civicrm_membership_type.weight',
469 'table_name' => 'civicrm_membership_type',
470 'entity' => 'MembershipType',
471 'bao' => 'CRM_Member_BAO_MembershipType',
477 'receipt_text_signup' => [
478 'name' => 'receipt_text_signup',
479 'type' => CRM_Utils_Type
::T_STRING
,
480 'title' => ts('Membership Type Receipt Text'),
481 'description' => ts('Receipt Text for membership signup'),
483 'size' => CRM_Utils_Type
::HUGE
,
484 'where' => 'civicrm_membership_type.receipt_text_signup',
485 'table_name' => 'civicrm_membership_type',
486 'entity' => 'MembershipType',
487 'bao' => 'CRM_Member_BAO_MembershipType',
490 'type' => 'TextArea',
493 'receipt_text_renewal' => [
494 'name' => 'receipt_text_renewal',
495 'type' => CRM_Utils_Type
::T_STRING
,
496 'title' => ts('Membership Type Renewal Text'),
497 'description' => ts('Receipt Text for membership renewal'),
499 'size' => CRM_Utils_Type
::HUGE
,
500 'where' => 'civicrm_membership_type.receipt_text_renewal',
501 'table_name' => 'civicrm_membership_type',
502 'entity' => 'MembershipType',
503 'bao' => 'CRM_Member_BAO_MembershipType',
506 'type' => 'TextArea',
510 'name' => 'auto_renew',
511 'type' => CRM_Utils_Type
::T_BOOLEAN
,
512 'title' => ts('Auto Renew'),
513 'description' => ts('0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;'),
514 'where' => 'civicrm_membership_type.auto_renew',
516 'table_name' => 'civicrm_membership_type',
517 'entity' => 'MembershipType',
518 'bao' => 'CRM_Member_BAO_MembershipType',
523 'pseudoconstant' => [
524 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
528 'name' => 'is_active',
529 'type' => CRM_Utils_Type
::T_BOOLEAN
,
530 'title' => ts('Is Active'),
531 'description' => ts('Is this membership_type enabled'),
532 'where' => 'civicrm_membership_type.is_active',
534 'table_name' => 'civicrm_membership_type',
535 'entity' => 'MembershipType',
536 'bao' => 'CRM_Member_BAO_MembershipType',
539 'type' => 'CheckBox',
540 'label' => ts("Enabled?"),
544 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
546 return Civi
::$statics[__CLASS__
]['fields'];
550 * Return a mapping from field-name to the corresponding key (as used in fields()).
553 * Array(string $name => string $uniqueName).
555 public static function &fieldKeys() {
556 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
557 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
559 return Civi
::$statics[__CLASS__
]['fieldKeys'];
563 * Returns the names of this table
567 public static function getTableName() {
568 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
572 * Returns if this table needs to be logged
576 public function getLog() {
581 * Returns the list of fields that can be imported
583 * @param bool $prefix
587 public static function &import($prefix = FALSE) {
588 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, []);
593 * Returns the list of fields that can be exported
595 * @param bool $prefix
599 public static function &export($prefix = FALSE) {
600 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, []);
605 * Returns the list of indices
607 * @param bool $localize
611 public static function indices($localize = TRUE) {
613 'index_relationship_type_id' => [
614 'name' => 'index_relationship_type_id',
616 0 => 'relationship_type_id',
618 'localizable' => FALSE,
619 'sig' => 'civicrm_membership_type::0::relationship_type_id',
622 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;