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:371e68c0fca2803c9b273bb25991a060)
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',
409 'relationship_direction' => [
410 'name' => 'relationship_direction',
411 'type' => CRM_Utils_Type
::T_STRING
,
412 'title' => ts('Relationship Direction'),
414 'size' => CRM_Utils_Type
::HUGE
,
415 'where' => 'civicrm_membership_type.relationship_direction',
416 'table_name' => 'civicrm_membership_type',
417 'entity' => 'MembershipType',
418 'bao' => 'CRM_Member_BAO_MembershipType',
422 'name' => 'max_related',
423 'type' => CRM_Utils_Type
::T_INT
,
424 'title' => ts('Max Related Members for Type'),
425 'description' => ts('Maximum number of related memberships.'),
426 'where' => 'civicrm_membership_type.max_related',
427 'table_name' => 'civicrm_membership_type',
428 'entity' => 'MembershipType',
429 'bao' => 'CRM_Member_BAO_MembershipType',
433 'label' => ts("Max Related"),
437 'name' => 'visibility',
438 'type' => CRM_Utils_Type
::T_STRING
,
439 'title' => ts('Visible'),
441 'size' => CRM_Utils_Type
::BIG
,
442 'where' => 'civicrm_membership_type.visibility',
443 'table_name' => 'civicrm_membership_type',
444 'entity' => 'MembershipType',
445 'bao' => 'CRM_Member_BAO_MembershipType',
450 'pseudoconstant' => [
451 'callback' => 'CRM_Core_SelectValues::memberVisibility',
456 'type' => CRM_Utils_Type
::T_INT
,
457 'title' => ts('Order'),
458 'where' => 'civicrm_membership_type.weight',
459 'table_name' => 'civicrm_membership_type',
460 'entity' => 'MembershipType',
461 'bao' => 'CRM_Member_BAO_MembershipType',
467 'receipt_text_signup' => [
468 'name' => 'receipt_text_signup',
469 'type' => CRM_Utils_Type
::T_STRING
,
470 'title' => ts('Membership Type Receipt Text'),
471 'description' => ts('Receipt Text for membership signup'),
473 'size' => CRM_Utils_Type
::HUGE
,
474 'where' => 'civicrm_membership_type.receipt_text_signup',
475 'table_name' => 'civicrm_membership_type',
476 'entity' => 'MembershipType',
477 'bao' => 'CRM_Member_BAO_MembershipType',
480 'type' => 'TextArea',
483 'receipt_text_renewal' => [
484 'name' => 'receipt_text_renewal',
485 'type' => CRM_Utils_Type
::T_STRING
,
486 'title' => ts('Membership Type Renewal Text'),
487 'description' => ts('Receipt Text for membership renewal'),
489 'size' => CRM_Utils_Type
::HUGE
,
490 'where' => 'civicrm_membership_type.receipt_text_renewal',
491 'table_name' => 'civicrm_membership_type',
492 'entity' => 'MembershipType',
493 'bao' => 'CRM_Member_BAO_MembershipType',
496 'type' => 'TextArea',
500 'name' => 'auto_renew',
501 'type' => CRM_Utils_Type
::T_BOOLEAN
,
502 'title' => ts('Auto Renew'),
503 'description' => ts('0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;'),
504 'where' => 'civicrm_membership_type.auto_renew',
506 'table_name' => 'civicrm_membership_type',
507 'entity' => 'MembershipType',
508 'bao' => 'CRM_Member_BAO_MembershipType',
513 'pseudoconstant' => [
514 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
518 'name' => 'is_active',
519 'type' => CRM_Utils_Type
::T_BOOLEAN
,
520 'title' => ts('Is Active'),
521 'description' => ts('Is this membership_type enabled'),
522 'where' => 'civicrm_membership_type.is_active',
524 'table_name' => 'civicrm_membership_type',
525 'entity' => 'MembershipType',
526 'bao' => 'CRM_Member_BAO_MembershipType',
529 'type' => 'CheckBox',
530 'label' => ts("Enabled?"),
534 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
536 return Civi
::$statics[__CLASS__
]['fields'];
540 * Return a mapping from field-name to the corresponding key (as used in fields()).
543 * Array(string $name => string $uniqueName).
545 public static function &fieldKeys() {
546 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
547 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
549 return Civi
::$statics[__CLASS__
]['fieldKeys'];
553 * Returns the names of this table
557 public static function getTableName() {
558 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
562 * Returns if this table needs to be logged
566 public function getLog() {
571 * Returns the list of fields that can be imported
573 * @param bool $prefix
577 public static function &import($prefix = FALSE) {
578 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, []);
583 * Returns the list of fields that can be exported
585 * @param bool $prefix
589 public static function &export($prefix = FALSE) {
590 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, []);
595 * Returns the list of indices
597 * @param bool $localize
601 public static function indices($localize = TRUE) {
603 'index_relationship_type_id' => [
604 'name' => 'index_relationship_type_id',
606 0 => 'relationship_type_id',
608 'localizable' => FALSE,
609 'sig' => 'civicrm_membership_type::0::relationship_type_id',
612 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;