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:c86019d4817d79e1dd59d69eaa2a3eb6)
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 'name' => 'description',
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('Membership Type Description'),
254 'description' => 'Description of Membership Type',
256 'size' => CRM_Utils_Type
::HUGE
,
257 'table_name' => 'civicrm_membership_type',
258 'entity' => 'MembershipType',
259 'bao' => 'CRM_Member_BAO_MembershipType',
262 'type' => 'TextArea',
265 'member_of_contact_id' => [
266 'name' => 'member_of_contact_id',
267 'type' => CRM_Utils_Type
::T_INT
,
268 'title' => ts('Membership Type Organization'),
269 'description' => 'Owner organization for this membership type. FK to Contact ID',
271 'table_name' => 'civicrm_membership_type',
272 'entity' => 'MembershipType',
273 'bao' => 'CRM_Member_BAO_MembershipType',
275 'FKClassName' => 'CRM_Contact_DAO_Contact',
277 'financial_type_id' => [
278 'name' => 'financial_type_id',
279 'type' => CRM_Utils_Type
::T_INT
,
280 'title' => ts('Membership Financial Type'),
281 'description' => 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id',
283 'table_name' => 'civicrm_membership_type',
284 'entity' => 'MembershipType',
285 'bao' => 'CRM_Member_BAO_MembershipType',
287 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
288 'pseudoconstant' => [
289 'table' => 'civicrm_financial_type',
291 'labelColumn' => 'name',
295 'name' => 'minimum_fee',
296 'type' => CRM_Utils_Type
::T_MONEY
,
297 'title' => ts('membership Type Minimum Fee'),
298 'description' => 'Minimum fee for this membership (0 for free/complimentary memberships).',
303 'table_name' => 'civicrm_membership_type',
304 'entity' => 'MembershipType',
305 'bao' => 'CRM_Member_BAO_MembershipType',
309 'name' => 'duration_unit',
310 'type' => CRM_Utils_Type
::T_STRING
,
311 'title' => ts('Membership Type Duration Unit'),
312 'description' => 'Unit in which membership period is expressed.',
314 'size' => CRM_Utils_Type
::EIGHT
,
315 'table_name' => 'civicrm_membership_type',
316 'entity' => 'MembershipType',
317 'bao' => 'CRM_Member_BAO_MembershipType',
322 'pseudoconstant' => [
323 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
326 'duration_interval' => [
327 'name' => 'duration_interval',
328 'type' => CRM_Utils_Type
::T_INT
,
329 'title' => ts('Membership Type Duration Interval'),
330 'description' => 'Number of duration units in membership period (e.g. 1 year, 12 months).',
331 'table_name' => 'civicrm_membership_type',
332 'entity' => 'MembershipType',
333 'bao' => 'CRM_Member_BAO_MembershipType',
337 'name' => 'period_type',
338 'type' => CRM_Utils_Type
::T_STRING
,
339 'title' => ts('Membership Type Plan'),
340 'description' => 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.',
342 'size' => CRM_Utils_Type
::EIGHT
,
343 'table_name' => 'civicrm_membership_type',
344 'entity' => 'MembershipType',
345 'bao' => 'CRM_Member_BAO_MembershipType',
347 'pseudoconstant' => [
348 'callback' => 'CRM_Core_SelectValues::periodType',
351 'fixed_period_start_day' => [
352 'name' => 'fixed_period_start_day',
353 'type' => CRM_Utils_Type
::T_INT
,
354 'title' => ts('Fixed Period Start Day'),
355 'description' => 'For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.',
356 'table_name' => 'civicrm_membership_type',
357 'entity' => 'MembershipType',
358 'bao' => 'CRM_Member_BAO_MembershipType',
361 'fixed_period_rollover_day' => [
362 'name' => 'fixed_period_rollover_day',
363 'type' => CRM_Utils_Type
::T_INT
,
364 'title' => ts('Fixed Period Rollover Day'),
365 'description' => 'For fixed period memberships, signups after this day (mmdd) rollover to next period.',
366 'table_name' => 'civicrm_membership_type',
367 'entity' => 'MembershipType',
368 'bao' => 'CRM_Member_BAO_MembershipType',
371 'relationship_type_id' => [
372 'name' => 'relationship_type_id',
373 'type' => CRM_Utils_Type
::T_STRING
,
374 'title' => ts('Membership Type Relationship'),
375 'description' => 'FK to Relationship Type ID',
377 'size' => CRM_Utils_Type
::BIG
,
378 'table_name' => 'civicrm_membership_type',
379 'entity' => 'MembershipType',
380 'bao' => 'CRM_Member_BAO_MembershipType',
383 'relationship_direction' => [
384 'name' => 'relationship_direction',
385 'type' => CRM_Utils_Type
::T_STRING
,
386 'title' => ts('Relationship Direction'),
388 'size' => CRM_Utils_Type
::HUGE
,
389 'table_name' => 'civicrm_membership_type',
390 'entity' => 'MembershipType',
391 'bao' => 'CRM_Member_BAO_MembershipType',
395 'name' => 'max_related',
396 'type' => CRM_Utils_Type
::T_INT
,
397 'title' => ts('Max Related Members for Type'),
398 'description' => 'Maximum number of related memberships.',
399 'table_name' => 'civicrm_membership_type',
400 'entity' => 'MembershipType',
401 'bao' => 'CRM_Member_BAO_MembershipType',
405 'name' => 'visibility',
406 'type' => CRM_Utils_Type
::T_STRING
,
407 'title' => ts('Visible'),
409 'size' => CRM_Utils_Type
::BIG
,
410 'table_name' => 'civicrm_membership_type',
411 'entity' => 'MembershipType',
412 'bao' => 'CRM_Member_BAO_MembershipType',
417 'pseudoconstant' => [
418 'callback' => 'CRM_Core_SelectValues::memberVisibility',
423 'type' => CRM_Utils_Type
::T_INT
,
424 'title' => ts('Order'),
425 'table_name' => 'civicrm_membership_type',
426 'entity' => 'MembershipType',
427 'bao' => 'CRM_Member_BAO_MembershipType',
430 'receipt_text_signup' => [
431 'name' => 'receipt_text_signup',
432 'type' => CRM_Utils_Type
::T_STRING
,
433 'title' => ts('Membership Type Receipt Text'),
434 'description' => 'Receipt Text for membership signup',
436 'size' => CRM_Utils_Type
::HUGE
,
437 'table_name' => 'civicrm_membership_type',
438 'entity' => 'MembershipType',
439 'bao' => 'CRM_Member_BAO_MembershipType',
442 'type' => 'TextArea',
445 'receipt_text_renewal' => [
446 'name' => 'receipt_text_renewal',
447 'type' => CRM_Utils_Type
::T_STRING
,
448 'title' => ts('Membership Type Renewal Text'),
449 'description' => 'Receipt Text for membership renewal',
451 'size' => CRM_Utils_Type
::HUGE
,
452 'table_name' => 'civicrm_membership_type',
453 'entity' => 'MembershipType',
454 'bao' => 'CRM_Member_BAO_MembershipType',
457 'type' => 'TextArea',
461 'name' => 'auto_renew',
462 'type' => CRM_Utils_Type
::T_BOOLEAN
,
463 'title' => ts('Auto Renew'),
464 'description' => '0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;',
465 'table_name' => 'civicrm_membership_type',
466 'entity' => 'MembershipType',
467 'bao' => 'CRM_Member_BAO_MembershipType',
469 'pseudoconstant' => [
470 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
474 'name' => 'is_active',
475 'type' => CRM_Utils_Type
::T_BOOLEAN
,
476 'title' => ts('Is Active'),
477 'description' => 'Is this membership_type enabled',
479 'table_name' => 'civicrm_membership_type',
480 'entity' => 'MembershipType',
481 'bao' => 'CRM_Member_BAO_MembershipType',
485 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
487 return Civi
::$statics[__CLASS__
]['fields'];
491 * Return a mapping from field-name to the corresponding key (as used in fields()).
494 * Array(string $name => string $uniqueName).
496 public static function &fieldKeys() {
497 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
498 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
500 return Civi
::$statics[__CLASS__
]['fieldKeys'];
504 * Returns the names of this table
508 public static function getTableName() {
509 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
513 * Returns if this table needs to be logged
517 public function getLog() {
522 * Returns the list of fields that can be imported
524 * @param bool $prefix
528 public static function &import($prefix = FALSE) {
529 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_type', $prefix, []);
534 * Returns the list of fields that can be exported
536 * @param bool $prefix
540 public static function &export($prefix = FALSE) {
541 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_type', $prefix, []);
546 * Returns the list of indices
548 * @param bool $localize
552 public static function indices($localize = TRUE) {
554 'index_relationship_type_id' => [
555 'name' => 'index_relationship_type_id',
557 0 => 'relationship_type_id',
559 'localizable' => FALSE,
560 'sig' => 'civicrm_membership_type::0::relationship_type_id',
563 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;