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:51b478b01b1ef20a54b1039ccc29d0ab)
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',
251 'label' => ts("Name"),
255 'name' => 'description',
256 'type' => CRM_Utils_Type
::T_STRING
,
257 'title' => ts('Membership Type Description'),
258 'description' => 'Description of Membership Type',
260 'size' => CRM_Utils_Type
::HUGE
,
261 'table_name' => 'civicrm_membership_type',
262 'entity' => 'MembershipType',
263 'bao' => 'CRM_Member_BAO_MembershipType',
266 'type' => 'TextArea',
267 'label' => ts("Description"),
270 'member_of_contact_id' => [
271 'name' => 'member_of_contact_id',
272 'type' => CRM_Utils_Type
::T_INT
,
273 'title' => ts('Membership Type Organization'),
274 'description' => 'Owner organization for this membership type. FK to Contact ID',
276 'table_name' => 'civicrm_membership_type',
277 'entity' => 'MembershipType',
278 'bao' => 'CRM_Member_BAO_MembershipType',
280 'FKClassName' => 'CRM_Contact_DAO_Contact',
282 'financial_type_id' => [
283 'name' => 'financial_type_id',
284 'type' => CRM_Utils_Type
::T_INT
,
285 'title' => ts('Membership Financial Type'),
286 'description' => 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id',
288 'table_name' => 'civicrm_membership_type',
289 'entity' => 'MembershipType',
290 'bao' => 'CRM_Member_BAO_MembershipType',
292 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
293 'pseudoconstant' => [
294 'table' => 'civicrm_financial_type',
296 'labelColumn' => 'name',
300 'name' => 'minimum_fee',
301 'type' => CRM_Utils_Type
::T_MONEY
,
302 'title' => ts('Membership Type Minimum Fee'),
303 'description' => 'Minimum fee for this membership (0 for free/complimentary memberships).',
308 'table_name' => 'civicrm_membership_type',
309 'entity' => 'MembershipType',
310 'bao' => 'CRM_Member_BAO_MembershipType',
314 'label' => ts("Minimum Fee"),
318 'name' => 'duration_unit',
319 'type' => CRM_Utils_Type
::T_STRING
,
320 'title' => ts('Membership Type Duration Unit'),
321 'description' => 'Unit in which membership period is expressed.',
323 'size' => CRM_Utils_Type
::EIGHT
,
324 'table_name' => 'civicrm_membership_type',
325 'entity' => 'MembershipType',
326 'bao' => 'CRM_Member_BAO_MembershipType',
331 'pseudoconstant' => [
332 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
335 'duration_interval' => [
336 'name' => 'duration_interval',
337 'type' => CRM_Utils_Type
::T_INT
,
338 'title' => ts('Membership Type Duration Interval'),
339 'description' => 'Number of duration units in membership period (e.g. 1 year, 12 months).',
340 'table_name' => 'civicrm_membership_type',
341 'entity' => 'MembershipType',
342 'bao' => 'CRM_Member_BAO_MembershipType',
349 'name' => 'period_type',
350 'type' => CRM_Utils_Type
::T_STRING
,
351 'title' => ts('Membership Type Plan'),
352 'description' => 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.',
354 'size' => CRM_Utils_Type
::EIGHT
,
355 'table_name' => 'civicrm_membership_type',
356 'entity' => 'MembershipType',
357 'bao' => 'CRM_Member_BAO_MembershipType',
362 'pseudoconstant' => [
363 'callback' => 'CRM_Core_SelectValues::periodType',
366 'fixed_period_start_day' => [
367 'name' => 'fixed_period_start_day',
368 'type' => CRM_Utils_Type
::T_INT
,
369 'title' => ts('Fixed Period Start Day'),
370 'description' => 'For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.',
371 'table_name' => 'civicrm_membership_type',
372 'entity' => 'MembershipType',
373 'bao' => 'CRM_Member_BAO_MembershipType',
376 'fixed_period_rollover_day' => [
377 'name' => 'fixed_period_rollover_day',
378 'type' => CRM_Utils_Type
::T_INT
,
379 'title' => ts('Fixed Period Rollover Day'),
380 'description' => 'For fixed period memberships, signups after this day (mmdd) rollover to next period.',
381 'table_name' => 'civicrm_membership_type',
382 'entity' => 'MembershipType',
383 'bao' => 'CRM_Member_BAO_MembershipType',
386 'relationship_type_id' => [
387 'name' => 'relationship_type_id',
388 'type' => CRM_Utils_Type
::T_STRING
,
389 'title' => ts('Membership Type Relationship'),
390 'description' => 'FK to Relationship Type ID',
392 'size' => CRM_Utils_Type
::BIG
,
393 'table_name' => 'civicrm_membership_type',
394 'entity' => 'MembershipType',
395 'bao' => 'CRM_Member_BAO_MembershipType',
398 'relationship_direction' => [
399 'name' => 'relationship_direction',
400 'type' => CRM_Utils_Type
::T_STRING
,
401 'title' => ts('Relationship Direction'),
403 'size' => CRM_Utils_Type
::HUGE
,
404 'table_name' => 'civicrm_membership_type',
405 'entity' => 'MembershipType',
406 'bao' => 'CRM_Member_BAO_MembershipType',
410 'name' => 'max_related',
411 'type' => CRM_Utils_Type
::T_INT
,
412 'title' => ts('Max Related Members for Type'),
413 'description' => 'Maximum number of related memberships.',
414 'table_name' => 'civicrm_membership_type',
415 'entity' => 'MembershipType',
416 'bao' => 'CRM_Member_BAO_MembershipType',
420 'label' => ts("Max Related"),
424 'name' => 'visibility',
425 'type' => CRM_Utils_Type
::T_STRING
,
426 'title' => ts('Visible'),
428 'size' => CRM_Utils_Type
::BIG
,
429 'table_name' => 'civicrm_membership_type',
430 'entity' => 'MembershipType',
431 'bao' => 'CRM_Member_BAO_MembershipType',
436 'pseudoconstant' => [
437 'callback' => 'CRM_Core_SelectValues::memberVisibility',
442 'type' => CRM_Utils_Type
::T_INT
,
443 'title' => ts('Order'),
444 'table_name' => 'civicrm_membership_type',
445 'entity' => 'MembershipType',
446 'bao' => 'CRM_Member_BAO_MembershipType',
452 'receipt_text_signup' => [
453 'name' => 'receipt_text_signup',
454 'type' => CRM_Utils_Type
::T_STRING
,
455 'title' => ts('Membership Type Receipt Text'),
456 'description' => 'Receipt Text for membership signup',
458 'size' => CRM_Utils_Type
::HUGE
,
459 'table_name' => 'civicrm_membership_type',
460 'entity' => 'MembershipType',
461 'bao' => 'CRM_Member_BAO_MembershipType',
464 'type' => 'TextArea',
467 'receipt_text_renewal' => [
468 'name' => 'receipt_text_renewal',
469 'type' => CRM_Utils_Type
::T_STRING
,
470 'title' => ts('Membership Type Renewal Text'),
471 'description' => 'Receipt Text for membership renewal',
473 'size' => CRM_Utils_Type
::HUGE
,
474 'table_name' => 'civicrm_membership_type',
475 'entity' => 'MembershipType',
476 'bao' => 'CRM_Member_BAO_MembershipType',
479 'type' => 'TextArea',
483 'name' => 'auto_renew',
484 'type' => CRM_Utils_Type
::T_BOOLEAN
,
485 'title' => ts('Auto Renew'),
486 'description' => '0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;',
487 'table_name' => 'civicrm_membership_type',
488 'entity' => 'MembershipType',
489 'bao' => 'CRM_Member_BAO_MembershipType',
491 'pseudoconstant' => [
492 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
496 'name' => 'is_active',
497 'type' => CRM_Utils_Type
::T_BOOLEAN
,
498 'title' => ts('Is Active'),
499 'description' => 'Is this membership_type enabled',
501 'table_name' => 'civicrm_membership_type',
502 'entity' => 'MembershipType',
503 'bao' => 'CRM_Member_BAO_MembershipType',
506 'type' => 'CheckBox',
507 'label' => ts("Enabled?"),
511 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
513 return Civi
::$statics[__CLASS__
]['fields'];
517 * Return a mapping from field-name to the corresponding key (as used in fields()).
520 * Array(string $name => string $uniqueName).
522 public static function &fieldKeys() {
523 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
524 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
526 return Civi
::$statics[__CLASS__
]['fieldKeys'];
530 * Returns the names of this table
534 public static function getTableName() {
535 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
539 * Returns if this table needs to be logged
543 public function getLog() {
548 * Returns the list of fields that can be imported
550 * @param bool $prefix
554 public static function &import($prefix = FALSE) {
555 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, []);
560 * Returns the list of fields that can be exported
562 * @param bool $prefix
566 public static function &export($prefix = FALSE) {
567 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, []);
572 * Returns the list of indices
574 * @param bool $localize
578 public static function indices($localize = TRUE) {
580 'index_relationship_type_id' => [
581 'name' => 'index_relationship_type_id',
583 0 => 'relationship_type_id',
585 'localizable' => FALSE,
586 'sig' => 'civicrm_membership_type::0::relationship_type_id',
589 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;