CRM-20312 regenerated DAOS with indexes
[civicrm-core.git] / CRM / Member / DAO / MembershipType.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Member/MembershipType.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e7a6b91a 33 * (GenCodeChecksum:22af2c3f87df3ad7cf2002c145f53cc6)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Member_DAO_MembershipType constructor.
39 */
e501603b
TO
40class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_membership_type';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Membership Id
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Which Domain is this match entry for
61 *
62 * @var int unsigned
63 */
64 public $domain_id;
65 /**
66 * Name of Membership Type
67 *
68 * @var string
69 */
70 public $name;
71 /**
72 * Description of Membership Type
73 *
74 * @var string
75 */
76 public $description;
77 /**
78 * Owner organization for this membership type. FK to Contact ID
79 *
80 * @var int unsigned
81 */
82 public $member_of_contact_id;
83 /**
84 * If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id
85 *
86 * @var int unsigned
87 */
88 public $financial_type_id;
89 /**
90 * Minimum fee for this membership (0 for free/complimentary memberships).
91 *
92 * @var float
93 */
94 public $minimum_fee;
95 /**
96 * Unit in which membership period is expressed.
97 *
98 * @var string
99 */
100 public $duration_unit;
101 /**
102 * Number of duration units in membership period (e.g. 1 year, 12 months).
103 *
104 * @var int
105 */
106 public $duration_interval;
107 /**
108 * Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.
109 *
110 * @var string
111 */
112 public $period_type;
113 /**
114 * For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.
115 *
116 * @var int
117 */
118 public $fixed_period_start_day;
119 /**
120 * For fixed period memberships, signups after this day (mmdd) rollover to next period.
121 *
122 * @var int
123 */
124 public $fixed_period_rollover_day;
125 /**
126 * FK to Relationship Type ID
127 *
128 * @var string
129 */
130 public $relationship_type_id;
131 /**
132 *
133 * @var string
134 */
135 public $relationship_direction;
136 /**
137 * Maximum number of related memberships.
138 *
139 * @var int
140 */
141 public $max_related;
142 /**
143 *
144 * @var string
145 */
146 public $visibility;
147 /**
148 *
149 * @var int
150 */
151 public $weight;
152 /**
153 * Receipt Text for membership signup
154 *
155 * @var string
156 */
157 public $receipt_text_signup;
158 /**
159 * Receipt Text for membership renewal
160 *
161 * @var string
162 */
163 public $receipt_text_renewal;
164 /**
165 * 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;
166 *
167 * @var boolean
168 */
169 public $auto_renew;
170 /**
171 * Is this membership_type enabled
172 *
173 * @var boolean
174 */
175 public $is_active;
176 /**
f41f0342 177 * Class constructor.
e501603b
TO
178 */
179 function __construct() {
180 $this->__table = 'civicrm_membership_type';
181 parent::__construct();
182 }
183 /**
f41f0342 184 * Returns foreign keys and entity references.
e501603b
TO
185 *
186 * @return array
187 * [CRM_Core_Reference_Interface]
188 */
189 static function getReferenceColumns() {
346aaaba
TO
190 if (!isset(Civi::$statics[__CLASS__]['links'])) {
191 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
192 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
193 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'member_of_contact_id', 'civicrm_contact', 'id');
194 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
195 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 196 }
346aaaba 197 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
198 }
199 /**
200 * Returns all the column names of this table
201 *
202 * @return array
203 */
204 static function &fields() {
346aaaba
TO
205 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
206 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
207 'id' => array(
208 'name' => 'id',
209 'type' => CRM_Utils_Type::T_INT,
210 'title' => ts('Membership Type ID') ,
211 'description' => 'Membership Id',
212 'required' => true,
522a26c9 213 'table_name' => 'civicrm_membership_type',
214 'entity' => 'MembershipType',
215 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 216 'localizable' => 0,
e501603b
TO
217 ) ,
218 'domain_id' => array(
219 'name' => 'domain_id',
220 'type' => CRM_Utils_Type::T_INT,
221 'title' => ts('Membership Type Domain') ,
222 'description' => 'Which Domain is this match entry for',
223 'required' => true,
522a26c9 224 'table_name' => 'civicrm_membership_type',
225 'entity' => 'MembershipType',
226 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 227 'localizable' => 0,
e501603b
TO
228 'FKClassName' => 'CRM_Core_DAO_Domain',
229 'pseudoconstant' => array(
230 'table' => 'civicrm_domain',
231 'keyColumn' => 'id',
232 'labelColumn' => 'name',
233 )
234 ) ,
235 'membership_type' => array(
236 'name' => 'name',
237 'type' => CRM_Utils_Type::T_STRING,
238 'title' => ts('Membership Type') ,
239 'description' => 'Name of Membership Type',
240 'maxlength' => 128,
241 'size' => CRM_Utils_Type::HUGE,
242 'import' => true,
243 'where' => 'civicrm_membership_type.name',
244 'headerPattern' => '',
245 'dataPattern' => '',
246 'export' => true,
522a26c9 247 'table_name' => 'civicrm_membership_type',
248 'entity' => 'MembershipType',
249 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 250 'localizable' => 1,
e501603b
TO
251 ) ,
252 'description' => array(
253 'name' => 'description',
254 'type' => CRM_Utils_Type::T_STRING,
255 'title' => ts('Membership Type Description') ,
256 'description' => 'Description of Membership Type',
257 'maxlength' => 255,
258 'size' => CRM_Utils_Type::HUGE,
522a26c9 259 'table_name' => 'civicrm_membership_type',
260 'entity' => 'MembershipType',
261 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 262 'localizable' => 1,
e501603b
TO
263 'html' => array(
264 'type' => 'TextArea',
265 ) ,
266 ) ,
267 'member_of_contact_id' => array(
268 'name' => 'member_of_contact_id',
269 'type' => CRM_Utils_Type::T_INT,
270 'title' => ts('Membership Type Organization') ,
271 'description' => 'Owner organization for this membership type. FK to Contact ID',
272 'required' => true,
522a26c9 273 'table_name' => 'civicrm_membership_type',
274 'entity' => 'MembershipType',
275 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 276 'localizable' => 0,
e501603b
TO
277 'FKClassName' => 'CRM_Contact_DAO_Contact',
278 ) ,
279 'financial_type_id' => array(
280 'name' => 'financial_type_id',
281 'type' => CRM_Utils_Type::T_INT,
282 'title' => ts('Membership Financial Type') ,
283 'description' => 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id',
284 'required' => true,
522a26c9 285 'table_name' => 'civicrm_membership_type',
286 'entity' => 'MembershipType',
287 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 288 'localizable' => 0,
e501603b
TO
289 'FKClassName' => 'CRM_Financial_DAO_FinancialType',
290 'pseudoconstant' => array(
291 'table' => 'civicrm_financial_type',
292 'keyColumn' => 'id',
293 'labelColumn' => 'name',
294 )
295 ) ,
296 'minimum_fee' => array(
297 'name' => 'minimum_fee',
298 'type' => CRM_Utils_Type::T_MONEY,
299 'title' => ts('membership Type Minimum Fee') ,
300 'description' => 'Minimum fee for this membership (0 for free/complimentary memberships).',
301 'precision' => array(
302 20,
303 2
304 ) ,
522a26c9 305 'table_name' => 'civicrm_membership_type',
306 'entity' => 'MembershipType',
307 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 308 'localizable' => 0,
e501603b
TO
309 ) ,
310 'duration_unit' => array(
311 'name' => 'duration_unit',
312 'type' => CRM_Utils_Type::T_STRING,
313 'title' => ts('Membership Type Duration Unit') ,
314 'description' => 'Unit in which membership period is expressed.',
315 'maxlength' => 8,
316 'size' => CRM_Utils_Type::EIGHT,
522a26c9 317 'table_name' => 'civicrm_membership_type',
318 'entity' => 'MembershipType',
319 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 320 'localizable' => 0,
e501603b
TO
321 'html' => array(
322 'type' => 'Select',
323 ) ,
324 'pseudoconstant' => array(
325 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList',
326 )
327 ) ,
328 'duration_interval' => array(
329 'name' => 'duration_interval',
330 'type' => CRM_Utils_Type::T_INT,
331 'title' => ts('Membership Type Duration Interval') ,
332 'description' => 'Number of duration units in membership period (e.g. 1 year, 12 months).',
522a26c9 333 'table_name' => 'civicrm_membership_type',
334 'entity' => 'MembershipType',
335 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 336 'localizable' => 0,
e501603b
TO
337 ) ,
338 'period_type' => array(
339 'name' => 'period_type',
340 'type' => CRM_Utils_Type::T_STRING,
341 'title' => ts('Membership Type Plan') ,
342 'description' => 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.',
343 'maxlength' => 8,
344 'size' => CRM_Utils_Type::EIGHT,
522a26c9 345 'table_name' => 'civicrm_membership_type',
346 'entity' => 'MembershipType',
347 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 348 'localizable' => 0,
e501603b
TO
349 'pseudoconstant' => array(
350 'callback' => 'CRM_Core_SelectValues::periodType',
351 )
352 ) ,
353 'fixed_period_start_day' => array(
354 'name' => 'fixed_period_start_day',
355 'type' => CRM_Utils_Type::T_INT,
356 'title' => ts('Fixed Period Start Day') ,
357 'description' => 'For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.',
522a26c9 358 'table_name' => 'civicrm_membership_type',
359 'entity' => 'MembershipType',
360 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 361 'localizable' => 0,
e501603b
TO
362 ) ,
363 'fixed_period_rollover_day' => array(
364 'name' => 'fixed_period_rollover_day',
365 'type' => CRM_Utils_Type::T_INT,
366 'title' => ts('Fixed Period Rollover Day') ,
367 'description' => 'For fixed period memberships, signups after this day (mmdd) rollover to next period.',
522a26c9 368 'table_name' => 'civicrm_membership_type',
369 'entity' => 'MembershipType',
370 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 371 'localizable' => 0,
e501603b
TO
372 ) ,
373 'relationship_type_id' => array(
374 'name' => 'relationship_type_id',
375 'type' => CRM_Utils_Type::T_STRING,
376 'title' => ts('Membership Type Relationship') ,
377 'description' => 'FK to Relationship Type ID',
378 'maxlength' => 64,
379 'size' => CRM_Utils_Type::BIG,
522a26c9 380 'table_name' => 'civicrm_membership_type',
381 'entity' => 'MembershipType',
382 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 383 'localizable' => 0,
e501603b
TO
384 ) ,
385 'relationship_direction' => array(
386 'name' => 'relationship_direction',
387 'type' => CRM_Utils_Type::T_STRING,
388 'title' => ts('Relationship Direction') ,
389 'maxlength' => 128,
390 'size' => CRM_Utils_Type::HUGE,
522a26c9 391 'table_name' => 'civicrm_membership_type',
392 'entity' => 'MembershipType',
393 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 394 'localizable' => 0,
e501603b
TO
395 ) ,
396 'max_related' => array(
397 'name' => 'max_related',
398 'type' => CRM_Utils_Type::T_INT,
399 'title' => ts('Max Related Members for Type') ,
400 'description' => 'Maximum number of related memberships.',
522a26c9 401 'table_name' => 'civicrm_membership_type',
402 'entity' => 'MembershipType',
403 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 404 'localizable' => 0,
e501603b
TO
405 ) ,
406 'visibility' => array(
407 'name' => 'visibility',
408 'type' => CRM_Utils_Type::T_STRING,
409 'title' => ts('Visible') ,
410 'maxlength' => 64,
411 'size' => CRM_Utils_Type::BIG,
522a26c9 412 'table_name' => 'civicrm_membership_type',
413 'entity' => 'MembershipType',
414 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 415 'localizable' => 0,
e501603b
TO
416 'html' => array(
417 'type' => 'Select',
418 ) ,
419 'pseudoconstant' => array(
420 'callback' => 'CRM_Core_SelectValues::memberVisibility',
421 )
422 ) ,
423 'weight' => array(
424 'name' => 'weight',
425 'type' => CRM_Utils_Type::T_INT,
426 'title' => ts('Order') ,
522a26c9 427 'table_name' => 'civicrm_membership_type',
428 'entity' => 'MembershipType',
429 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 430 'localizable' => 0,
e501603b
TO
431 ) ,
432 'receipt_text_signup' => array(
433 'name' => 'receipt_text_signup',
434 'type' => CRM_Utils_Type::T_STRING,
435 'title' => ts('Membership Type Receipt Text') ,
436 'description' => 'Receipt Text for membership signup',
437 'maxlength' => 255,
438 'size' => CRM_Utils_Type::HUGE,
522a26c9 439 'table_name' => 'civicrm_membership_type',
440 'entity' => 'MembershipType',
441 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 442 'localizable' => 0,
e501603b
TO
443 'html' => array(
444 'type' => 'TextArea',
445 ) ,
446 ) ,
447 'receipt_text_renewal' => array(
448 'name' => 'receipt_text_renewal',
449 'type' => CRM_Utils_Type::T_STRING,
450 'title' => ts('Membership Type Renewal Text') ,
451 'description' => 'Receipt Text for membership renewal',
452 'maxlength' => 255,
453 'size' => CRM_Utils_Type::HUGE,
522a26c9 454 'table_name' => 'civicrm_membership_type',
455 'entity' => 'MembershipType',
456 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 457 'localizable' => 0,
e501603b
TO
458 'html' => array(
459 'type' => 'TextArea',
460 ) ,
461 ) ,
462 'auto_renew' => array(
463 'name' => 'auto_renew',
464 'type' => CRM_Utils_Type::T_BOOLEAN,
465 'title' => ts('Auto Renew') ,
466 'description' => '0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;',
522a26c9 467 'table_name' => 'civicrm_membership_type',
468 'entity' => 'MembershipType',
469 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 470 'localizable' => 0,
e501603b
TO
471 'pseudoconstant' => array(
472 'callback' => 'CRM_Core_SelectValues::memberAutoRenew',
473 )
474 ) ,
475 'is_active' => array(
476 'name' => 'is_active',
477 'type' => CRM_Utils_Type::T_BOOLEAN,
478 'title' => ts('Is Active') ,
479 'description' => 'Is this membership_type enabled',
480 'default' => '1',
522a26c9 481 'table_name' => 'civicrm_membership_type',
482 'entity' => 'MembershipType',
483 'bao' => 'CRM_Member_BAO_MembershipType',
6a7e5e5d 484 'localizable' => 0,
e501603b
TO
485 ) ,
486 );
346aaaba 487 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 488 }
346aaaba 489 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
490 }
491 /**
bd8e0b14 492 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
493 *
494 * @return array
bd8e0b14 495 * Array(string $name => string $uniqueName).
e501603b
TO
496 */
497 static function &fieldKeys() {
bd8e0b14
TO
498 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
499 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 500 }
bd8e0b14 501 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
502 }
503 /**
504 * Returns the names of this table
505 *
506 * @return string
507 */
508 static function getTableName() {
509 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
510 }
511 /**
512 * Returns if this table needs to be logged
513 *
514 * @return boolean
515 */
516 function getLog() {
517 return self::$_log;
518 }
519 /**
520 * Returns the list of fields that can be imported
521 *
522 * @param bool $prefix
523 *
524 * @return array
525 */
526 static function &import($prefix = false) {
60808919
TO
527 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_type', $prefix, array());
528 return $r;
e501603b
TO
529 }
530 /**
531 * Returns the list of fields that can be exported
532 *
533 * @param bool $prefix
534 *
535 * @return array
536 */
537 static function &export($prefix = false) {
60808919
TO
538 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_type', $prefix, array());
539 return $r;
e501603b 540 }
e7a6b91a
AS
541 /**
542 * Returns the list of indices
543 */
544 public static function indices($localize = TRUE) {
545 $indices = array(
546 'index_relationship_type_id' => array(
547 'name' => 'index_relationship_type_id',
548 'field' => array(
549 0 => 'relationship_type_id',
550 ) ,
551 'localizable' => false,
552 'sig' => 'civicrm_membership_type::0::relationship_type_id',
553 ) ,
554 );
555 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
556 }
e501603b 557}