5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Member/MembershipType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:f0aee394cff9d0c7eee0245021a4a3e1)
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'),
241 'size' => CRM_Utils_Type
::HUGE
,
243 'where' => 'civicrm_membership_type.name',
245 'table_name' => 'civicrm_membership_type',
246 'entity' => 'MembershipType',
247 'bao' => 'CRM_Member_BAO_MembershipType',
251 'label' => ts("Name"),
255 'name' => 'description',
256 'type' => CRM_Utils_Type
::T_STRING
,
257 'title' => ts('Membership Type Description'),
258 'description' => ts('Description of Membership Type'),
260 'size' => CRM_Utils_Type
::HUGE
,
261 'where' => 'civicrm_membership_type.description',
262 'table_name' => 'civicrm_membership_type',
263 'entity' => 'MembershipType',
264 'bao' => 'CRM_Member_BAO_MembershipType',
267 'type' => 'TextArea',
268 'label' => ts("Description"),
271 'member_of_contact_id' => [
272 'name' => 'member_of_contact_id',
273 'type' => CRM_Utils_Type
::T_INT
,
274 'title' => ts('Membership Type Organization'),
275 'description' => ts('Owner organization for this membership type. FK to Contact ID'),
277 'where' => 'civicrm_membership_type.member_of_contact_id',
278 'table_name' => 'civicrm_membership_type',
279 'entity' => 'MembershipType',
280 'bao' => 'CRM_Member_BAO_MembershipType',
282 'FKClassName' => 'CRM_Contact_DAO_Contact',
284 'financial_type_id' => [
285 'name' => 'financial_type_id',
286 'type' => CRM_Utils_Type
::T_INT
,
287 'title' => ts('Membership Financial Type'),
288 'description' => ts('If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id'),
290 'where' => 'civicrm_membership_type.financial_type_id',
291 'table_name' => 'civicrm_membership_type',
292 'entity' => 'MembershipType',
293 'bao' => 'CRM_Member_BAO_MembershipType',
295 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
296 'pseudoconstant' => [
297 'table' => 'civicrm_financial_type',
299 'labelColumn' => 'name',
303 'name' => 'minimum_fee',
304 'type' => CRM_Utils_Type
::T_MONEY
,
305 'title' => ts('Membership Type Minimum Fee'),
306 'description' => ts('Minimum fee for this membership (0 for free/complimentary memberships).'),
311 'where' => 'civicrm_membership_type.minimum_fee',
313 'table_name' => 'civicrm_membership_type',
314 'entity' => 'MembershipType',
315 'bao' => 'CRM_Member_BAO_MembershipType',
319 'label' => ts("Minimum Fee"),
323 'name' => 'duration_unit',
324 'type' => CRM_Utils_Type
::T_STRING
,
325 'title' => ts('Membership Type Duration Unit'),
326 'description' => ts('Unit in which membership period is expressed.'),
328 'size' => CRM_Utils_Type
::EIGHT
,
329 'where' => 'civicrm_membership_type.duration_unit',
330 'table_name' => 'civicrm_membership_type',
331 'entity' => 'MembershipType',
332 'bao' => 'CRM_Member_BAO_MembershipType',
337 'pseudoconstant' => [
338 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
341 'duration_interval' => [
342 'name' => 'duration_interval',
343 'type' => CRM_Utils_Type
::T_INT
,
344 'title' => ts('Membership Type Duration Interval'),
345 'description' => ts('Number of duration units in membership period (e.g. 1 year, 12 months).'),
346 'where' => 'civicrm_membership_type.duration_interval',
347 'table_name' => 'civicrm_membership_type',
348 'entity' => 'MembershipType',
349 'bao' => 'CRM_Member_BAO_MembershipType',
356 'name' => 'period_type',
357 'type' => CRM_Utils_Type
::T_STRING
,
358 'title' => ts('Membership Type Plan'),
359 'description' => ts('Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.'),
361 'size' => CRM_Utils_Type
::EIGHT
,
362 'where' => 'civicrm_membership_type.period_type',
363 'table_name' => 'civicrm_membership_type',
364 'entity' => 'MembershipType',
365 'bao' => 'CRM_Member_BAO_MembershipType',
370 'pseudoconstant' => [
371 'callback' => 'CRM_Core_SelectValues::periodType',
374 'fixed_period_start_day' => [
375 'name' => 'fixed_period_start_day',
376 'type' => CRM_Utils_Type
::T_INT
,
377 'title' => ts('Fixed Period Start Day'),
378 '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.'),
379 'where' => 'civicrm_membership_type.fixed_period_start_day',
380 'table_name' => 'civicrm_membership_type',
381 'entity' => 'MembershipType',
382 'bao' => 'CRM_Member_BAO_MembershipType',
385 'fixed_period_rollover_day' => [
386 'name' => 'fixed_period_rollover_day',
387 'type' => CRM_Utils_Type
::T_INT
,
388 'title' => ts('Fixed Period Rollover Day'),
389 'description' => ts('For fixed period memberships, signups after this day (mmdd) rollover to next period.'),
390 'where' => 'civicrm_membership_type.fixed_period_rollover_day',
391 'table_name' => 'civicrm_membership_type',
392 'entity' => 'MembershipType',
393 'bao' => 'CRM_Member_BAO_MembershipType',
396 'relationship_type_id' => [
397 'name' => 'relationship_type_id',
398 'type' => CRM_Utils_Type
::T_STRING
,
399 'title' => ts('Membership Type Relationship'),
400 'description' => ts('FK to Relationship Type ID'),
402 'size' => CRM_Utils_Type
::BIG
,
403 'where' => 'civicrm_membership_type.relationship_type_id',
404 'table_name' => 'civicrm_membership_type',
405 'entity' => 'MembershipType',
406 'bao' => 'CRM_Member_BAO_MembershipType',
408 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
410 'relationship_direction' => [
411 'name' => 'relationship_direction',
412 'type' => CRM_Utils_Type
::T_STRING
,
413 'title' => ts('Relationship Direction'),
415 'size' => CRM_Utils_Type
::HUGE
,
416 'where' => 'civicrm_membership_type.relationship_direction',
417 'table_name' => 'civicrm_membership_type',
418 'entity' => 'MembershipType',
419 'bao' => 'CRM_Member_BAO_MembershipType',
421 'serialize' => self
::SERIALIZE_SEPARATOR_TRIMMED
,
424 'name' => 'max_related',
425 'type' => CRM_Utils_Type
::T_INT
,
426 'title' => ts('Max Related Members for Type'),
427 'description' => ts('Maximum number of related memberships.'),
428 'where' => 'civicrm_membership_type.max_related',
429 'table_name' => 'civicrm_membership_type',
430 'entity' => 'MembershipType',
431 'bao' => 'CRM_Member_BAO_MembershipType',
435 'label' => ts("Max Related"),
439 'name' => 'visibility',
440 'type' => CRM_Utils_Type
::T_STRING
,
441 'title' => ts('Visible'),
443 'size' => CRM_Utils_Type
::BIG
,
444 'where' => 'civicrm_membership_type.visibility',
445 'table_name' => 'civicrm_membership_type',
446 'entity' => 'MembershipType',
447 'bao' => 'CRM_Member_BAO_MembershipType',
452 'pseudoconstant' => [
453 'callback' => 'CRM_Core_SelectValues::memberVisibility',
458 'type' => CRM_Utils_Type
::T_INT
,
459 'title' => ts('Order'),
460 'where' => 'civicrm_membership_type.weight',
461 'table_name' => 'civicrm_membership_type',
462 'entity' => 'MembershipType',
463 'bao' => 'CRM_Member_BAO_MembershipType',
469 'receipt_text_signup' => [
470 'name' => 'receipt_text_signup',
471 'type' => CRM_Utils_Type
::T_STRING
,
472 'title' => ts('Membership Type Receipt Text'),
473 'description' => ts('Receipt Text for membership signup'),
475 'size' => CRM_Utils_Type
::HUGE
,
476 'where' => 'civicrm_membership_type.receipt_text_signup',
477 'table_name' => 'civicrm_membership_type',
478 'entity' => 'MembershipType',
479 'bao' => 'CRM_Member_BAO_MembershipType',
482 'type' => 'TextArea',
485 'receipt_text_renewal' => [
486 'name' => 'receipt_text_renewal',
487 'type' => CRM_Utils_Type
::T_STRING
,
488 'title' => ts('Membership Type Renewal Text'),
489 'description' => ts('Receipt Text for membership renewal'),
491 'size' => CRM_Utils_Type
::HUGE
,
492 'where' => 'civicrm_membership_type.receipt_text_renewal',
493 'table_name' => 'civicrm_membership_type',
494 'entity' => 'MembershipType',
495 'bao' => 'CRM_Member_BAO_MembershipType',
498 'type' => 'TextArea',
502 'name' => 'auto_renew',
503 'type' => CRM_Utils_Type
::T_BOOLEAN
,
504 'title' => ts('Auto Renew'),
505 'description' => ts('0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;'),
506 'where' => 'civicrm_membership_type.auto_renew',
508 'table_name' => 'civicrm_membership_type',
509 'entity' => 'MembershipType',
510 'bao' => 'CRM_Member_BAO_MembershipType',
515 'pseudoconstant' => [
516 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
520 'name' => 'is_active',
521 'type' => CRM_Utils_Type
::T_BOOLEAN
,
522 'title' => ts('Is Active'),
523 'description' => ts('Is this membership_type enabled'),
524 'where' => 'civicrm_membership_type.is_active',
526 'table_name' => 'civicrm_membership_type',
527 'entity' => 'MembershipType',
528 'bao' => 'CRM_Member_BAO_MembershipType',
531 'type' => 'CheckBox',
532 'label' => ts("Enabled?"),
536 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
538 return Civi
::$statics[__CLASS__
]['fields'];
542 * Return a mapping from field-name to the corresponding key (as used in fields()).
545 * Array(string $name => string $uniqueName).
547 public static function &fieldKeys() {
548 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
549 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
551 return Civi
::$statics[__CLASS__
]['fieldKeys'];
555 * Returns the names of this table
559 public static function getTableName() {
560 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
564 * Returns if this table needs to be logged
568 public function getLog() {
573 * Returns the list of fields that can be imported
575 * @param bool $prefix
579 public static function &import($prefix = FALSE) {
580 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, []);
585 * Returns the list of fields that can be exported
587 * @param bool $prefix
591 public static function &export($prefix = FALSE) {
592 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, []);
597 * Returns the list of indices
599 * @param bool $localize
603 public static function indices($localize = TRUE) {
605 'index_relationship_type_id' => [
606 'name' => 'index_relationship_type_id',
608 0 => 'relationship_type_id',
610 'localizable' => FALSE,
611 'sig' => 'civicrm_membership_type::0::relationship_type_id',
614 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;