5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Member/MembershipType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f79b8b7075dd740416b24eff8ebd147b)
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 static $_tableName = 'civicrm_membership_type';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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' => 'Membership Id',
211 'table_name' => 'civicrm_membership_type',
212 'entity' => 'MembershipType',
213 'bao' => 'CRM_Member_BAO_MembershipType',
217 'name' => 'domain_id',
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Membership Type Domain'),
220 'description' => 'Which Domain is this match entry for',
222 'table_name' => 'civicrm_membership_type',
223 'entity' => 'MembershipType',
224 'bao' => 'CRM_Member_BAO_MembershipType',
226 'FKClassName' => 'CRM_Core_DAO_Domain',
227 'pseudoconstant' => [
228 'table' => 'civicrm_domain',
230 'labelColumn' => 'name',
233 'membership_type' => [
235 'type' => CRM_Utils_Type
::T_STRING
,
236 'title' => ts('Membership Type'),
237 'description' => 'Name of Membership Type',
239 'size' => CRM_Utils_Type
::HUGE
,
241 'where' => 'civicrm_membership_type.name',
242 'headerPattern' => '',
245 'table_name' => 'civicrm_membership_type',
246 'entity' => 'MembershipType',
247 'bao' => 'CRM_Member_BAO_MembershipType',
254 'name' => 'description',
255 'type' => CRM_Utils_Type
::T_STRING
,
256 'title' => ts('Membership Type Description'),
257 'description' => 'Description of Membership Type',
259 'size' => CRM_Utils_Type
::HUGE
,
260 'table_name' => 'civicrm_membership_type',
261 'entity' => 'MembershipType',
262 'bao' => 'CRM_Member_BAO_MembershipType',
265 'type' => 'TextArea',
268 'member_of_contact_id' => [
269 'name' => 'member_of_contact_id',
270 'type' => CRM_Utils_Type
::T_INT
,
271 'title' => ts('Membership Type Organization'),
272 'description' => 'Owner organization for this membership type. FK to Contact ID',
274 'table_name' => 'civicrm_membership_type',
275 'entity' => 'MembershipType',
276 'bao' => 'CRM_Member_BAO_MembershipType',
278 'FKClassName' => 'CRM_Contact_DAO_Contact',
280 'financial_type_id' => [
281 'name' => 'financial_type_id',
282 'type' => CRM_Utils_Type
::T_INT
,
283 'title' => ts('Membership Financial Type'),
284 'description' => 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id',
286 'table_name' => 'civicrm_membership_type',
287 'entity' => 'MembershipType',
288 'bao' => 'CRM_Member_BAO_MembershipType',
290 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
291 'pseudoconstant' => [
292 'table' => 'civicrm_financial_type',
294 'labelColumn' => 'name',
298 'name' => 'minimum_fee',
299 'type' => CRM_Utils_Type
::T_MONEY
,
300 'title' => ts('Membership Type Minimum Fee'),
301 'description' => 'Minimum fee for this membership (0 for free/complimentary memberships).',
306 'table_name' => 'civicrm_membership_type',
307 'entity' => 'MembershipType',
308 'bao' => 'CRM_Member_BAO_MembershipType',
315 'name' => 'duration_unit',
316 'type' => CRM_Utils_Type
::T_STRING
,
317 'title' => ts('Membership Type Duration Unit'),
318 'description' => 'Unit in which membership period is expressed.',
320 'size' => CRM_Utils_Type
::EIGHT
,
321 'table_name' => 'civicrm_membership_type',
322 'entity' => 'MembershipType',
323 'bao' => 'CRM_Member_BAO_MembershipType',
328 'pseudoconstant' => [
329 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
332 'duration_interval' => [
333 'name' => 'duration_interval',
334 'type' => CRM_Utils_Type
::T_INT
,
335 'title' => ts('Membership Type Duration Interval'),
336 'description' => 'Number of duration units in membership period (e.g. 1 year, 12 months).',
337 'table_name' => 'civicrm_membership_type',
338 'entity' => 'MembershipType',
339 'bao' => 'CRM_Member_BAO_MembershipType',
346 'name' => 'period_type',
347 'type' => CRM_Utils_Type
::T_STRING
,
348 'title' => ts('Membership Type Plan'),
349 'description' => 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.',
351 'size' => CRM_Utils_Type
::EIGHT
,
352 'table_name' => 'civicrm_membership_type',
353 'entity' => 'MembershipType',
354 'bao' => 'CRM_Member_BAO_MembershipType',
359 'pseudoconstant' => [
360 'callback' => 'CRM_Core_SelectValues::periodType',
363 'fixed_period_start_day' => [
364 'name' => 'fixed_period_start_day',
365 'type' => CRM_Utils_Type
::T_INT
,
366 'title' => ts('Fixed Period Start Day'),
367 'description' => 'For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.',
368 'table_name' => 'civicrm_membership_type',
369 'entity' => 'MembershipType',
370 'bao' => 'CRM_Member_BAO_MembershipType',
373 'fixed_period_rollover_day' => [
374 'name' => 'fixed_period_rollover_day',
375 'type' => CRM_Utils_Type
::T_INT
,
376 'title' => ts('Fixed Period Rollover Day'),
377 'description' => 'For fixed period memberships, signups after this day (mmdd) rollover to next period.',
378 'table_name' => 'civicrm_membership_type',
379 'entity' => 'MembershipType',
380 'bao' => 'CRM_Member_BAO_MembershipType',
383 'relationship_type_id' => [
384 'name' => 'relationship_type_id',
385 'type' => CRM_Utils_Type
::T_STRING
,
386 'title' => ts('Membership Type Relationship'),
387 'description' => 'FK to Relationship Type ID',
389 'size' => CRM_Utils_Type
::BIG
,
390 'table_name' => 'civicrm_membership_type',
391 'entity' => 'MembershipType',
392 'bao' => 'CRM_Member_BAO_MembershipType',
395 'relationship_direction' => [
396 'name' => 'relationship_direction',
397 'type' => CRM_Utils_Type
::T_STRING
,
398 'title' => ts('Relationship Direction'),
400 'size' => CRM_Utils_Type
::HUGE
,
401 'table_name' => 'civicrm_membership_type',
402 'entity' => 'MembershipType',
403 'bao' => 'CRM_Member_BAO_MembershipType',
407 'name' => 'max_related',
408 'type' => CRM_Utils_Type
::T_INT
,
409 'title' => ts('Max Related Members for Type'),
410 'description' => 'Maximum number of related memberships.',
411 'table_name' => 'civicrm_membership_type',
412 'entity' => 'MembershipType',
413 'bao' => 'CRM_Member_BAO_MembershipType',
420 'name' => 'visibility',
421 'type' => CRM_Utils_Type
::T_STRING
,
422 'title' => ts('Visible'),
424 'size' => CRM_Utils_Type
::BIG
,
425 'table_name' => 'civicrm_membership_type',
426 'entity' => 'MembershipType',
427 'bao' => 'CRM_Member_BAO_MembershipType',
432 'pseudoconstant' => [
433 'callback' => 'CRM_Core_SelectValues::memberVisibility',
438 'type' => CRM_Utils_Type
::T_INT
,
439 'title' => ts('Order'),
440 'table_name' => 'civicrm_membership_type',
441 'entity' => 'MembershipType',
442 'bao' => 'CRM_Member_BAO_MembershipType',
448 'receipt_text_signup' => [
449 'name' => 'receipt_text_signup',
450 'type' => CRM_Utils_Type
::T_STRING
,
451 'title' => ts('Membership Type Receipt Text'),
452 'description' => 'Receipt Text for membership signup',
454 'size' => CRM_Utils_Type
::HUGE
,
455 'table_name' => 'civicrm_membership_type',
456 'entity' => 'MembershipType',
457 'bao' => 'CRM_Member_BAO_MembershipType',
460 'type' => 'TextArea',
463 'receipt_text_renewal' => [
464 'name' => 'receipt_text_renewal',
465 'type' => CRM_Utils_Type
::T_STRING
,
466 'title' => ts('Membership Type Renewal Text'),
467 'description' => 'Receipt Text for membership renewal',
469 'size' => CRM_Utils_Type
::HUGE
,
470 'table_name' => 'civicrm_membership_type',
471 'entity' => 'MembershipType',
472 'bao' => 'CRM_Member_BAO_MembershipType',
475 'type' => 'TextArea',
479 'name' => 'auto_renew',
480 'type' => CRM_Utils_Type
::T_BOOLEAN
,
481 'title' => ts('Auto Renew'),
482 'description' => '0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;',
483 'table_name' => 'civicrm_membership_type',
484 'entity' => 'MembershipType',
485 'bao' => 'CRM_Member_BAO_MembershipType',
487 'pseudoconstant' => [
488 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
492 'name' => 'is_active',
493 'type' => CRM_Utils_Type
::T_BOOLEAN
,
494 'title' => ts('Is Active'),
495 'description' => 'Is this membership_type enabled',
497 'table_name' => 'civicrm_membership_type',
498 'entity' => 'MembershipType',
499 'bao' => 'CRM_Member_BAO_MembershipType',
502 'type' => 'CheckBox',
506 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
508 return Civi
::$statics[__CLASS__
]['fields'];
512 * Return a mapping from field-name to the corresponding key (as used in fields()).
515 * Array(string $name => string $uniqueName).
517 public static function &fieldKeys() {
518 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
519 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
521 return Civi
::$statics[__CLASS__
]['fieldKeys'];
525 * Returns the names of this table
529 public static function getTableName() {
530 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
534 * Returns if this table needs to be logged
538 public function getLog() {
543 * Returns the list of fields that can be imported
545 * @param bool $prefix
549 public static function &import($prefix = FALSE) {
550 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, []);
555 * Returns the list of fields that can be exported
557 * @param bool $prefix
561 public static function &export($prefix = FALSE) {
562 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, []);
567 * Returns the list of indices
569 * @param bool $localize
573 public static function indices($localize = TRUE) {
575 'index_relationship_type_id' => [
576 'name' => 'index_relationship_type_id',
578 0 => 'relationship_type_id',
580 'localizable' => FALSE,
581 'sig' => 'civicrm_membership_type::0::relationship_type_id',
584 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;