API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Member / DAO / MembershipStatus.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Member/MembershipStatus.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e6fe414d2b0dc3ff72ee5adcad75fab8)
10 */
11
12 /**
13 * Database access object for the MembershipStatus entity.
14 */
15 class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_membership_status';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = TRUE;
30
31 /**
32 * Membership Id
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Name for Membership Status
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * Label for Membership Status
47 *
48 * @var string
49 */
50 public $label;
51
52 /**
53 * Event when this status starts.
54 *
55 * @var string
56 */
57 public $start_event;
58
59 /**
60 * Unit used for adjusting from start_event.
61 *
62 * @var string
63 */
64 public $start_event_adjust_unit;
65
66 /**
67 * Status range begins this many units from start_event.
68 *
69 * @var int
70 */
71 public $start_event_adjust_interval;
72
73 /**
74 * Event after which this status ends.
75 *
76 * @var string
77 */
78 public $end_event;
79
80 /**
81 * Unit used for adjusting from the ending event.
82 *
83 * @var string
84 */
85 public $end_event_adjust_unit;
86
87 /**
88 * Status range ends this many units from end_event.
89 *
90 * @var int
91 */
92 public $end_event_adjust_interval;
93
94 /**
95 * Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE).
96 *
97 * @var bool
98 */
99 public $is_current_member;
100
101 /**
102 * Is this status for admin/manual assignment only.
103 *
104 * @var bool
105 */
106 public $is_admin;
107
108 /**
109 * @var int
110 */
111 public $weight;
112
113 /**
114 * Assign this status to a membership record if no other status match is found.
115 *
116 * @var bool
117 */
118 public $is_default;
119
120 /**
121 * Is this membership_status enabled.
122 *
123 * @var bool
124 */
125 public $is_active;
126
127 /**
128 * Is this membership_status reserved.
129 *
130 * @var bool
131 */
132 public $is_reserved;
133
134 /**
135 * Class constructor.
136 */
137 public function __construct() {
138 $this->__table = 'civicrm_membership_status';
139 parent::__construct();
140 }
141
142 /**
143 * Returns localized title of this entity.
144 */
145 public static function getEntityTitle() {
146 return ts('Membership Statuses');
147 }
148
149 /**
150 * Returns all the column names of this table
151 *
152 * @return array
153 */
154 public static function &fields() {
155 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
156 Civi::$statics[__CLASS__]['fields'] = [
157 'id' => [
158 'name' => 'id',
159 'type' => CRM_Utils_Type::T_INT,
160 'title' => ts('Membership Status ID'),
161 'description' => ts('Membership Id'),
162 'required' => TRUE,
163 'where' => 'civicrm_membership_status.id',
164 'table_name' => 'civicrm_membership_status',
165 'entity' => 'MembershipStatus',
166 'bao' => 'CRM_Member_BAO_MembershipStatus',
167 'localizable' => 0,
168 'add' => '1.5',
169 ],
170 'membership_status' => [
171 'name' => 'name',
172 'type' => CRM_Utils_Type::T_STRING,
173 'title' => ts('Membership Status'),
174 'description' => ts('Name for Membership Status'),
175 'maxlength' => 128,
176 'size' => CRM_Utils_Type::HUGE,
177 'import' => TRUE,
178 'where' => 'civicrm_membership_status.name',
179 'export' => TRUE,
180 'table_name' => 'civicrm_membership_status',
181 'entity' => 'MembershipStatus',
182 'bao' => 'CRM_Member_BAO_MembershipStatus',
183 'localizable' => 0,
184 'add' => '1.5',
185 ],
186 'label' => [
187 'name' => 'label',
188 'type' => CRM_Utils_Type::T_STRING,
189 'title' => ts('Label'),
190 'description' => ts('Label for Membership Status'),
191 'maxlength' => 128,
192 'size' => CRM_Utils_Type::HUGE,
193 'where' => 'civicrm_membership_status.label',
194 'table_name' => 'civicrm_membership_status',
195 'entity' => 'MembershipStatus',
196 'bao' => 'CRM_Member_BAO_MembershipStatus',
197 'localizable' => 1,
198 'html' => [
199 'type' => 'Text',
200 ],
201 'add' => '3.2',
202 ],
203 'start_event' => [
204 'name' => 'start_event',
205 'type' => CRM_Utils_Type::T_STRING,
206 'title' => ts('Start Event'),
207 'description' => ts('Event when this status starts.'),
208 'maxlength' => 12,
209 'size' => CRM_Utils_Type::TWELVE,
210 'where' => 'civicrm_membership_status.start_event',
211 'table_name' => 'civicrm_membership_status',
212 'entity' => 'MembershipStatus',
213 'bao' => 'CRM_Member_BAO_MembershipStatus',
214 'localizable' => 0,
215 'html' => [
216 'type' => 'Select',
217 ],
218 'pseudoconstant' => [
219 'callback' => 'CRM_Core_SelectValues::eventDate',
220 ],
221 'add' => '1.5',
222 ],
223 'start_event_adjust_unit' => [
224 'name' => 'start_event_adjust_unit',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('Start Event Adjust Unit'),
227 'description' => ts('Unit used for adjusting from start_event.'),
228 'maxlength' => 8,
229 'size' => CRM_Utils_Type::EIGHT,
230 'where' => 'civicrm_membership_status.start_event_adjust_unit',
231 'table_name' => 'civicrm_membership_status',
232 'entity' => 'MembershipStatus',
233 'bao' => 'CRM_Member_BAO_MembershipStatus',
234 'localizable' => 0,
235 'html' => [
236 'type' => 'Select',
237 ],
238 'pseudoconstant' => [
239 'callback' => 'CRM_Core_SelectValues::unitList',
240 ],
241 'add' => '1.5',
242 ],
243 'start_event_adjust_interval' => [
244 'name' => 'start_event_adjust_interval',
245 'type' => CRM_Utils_Type::T_INT,
246 'title' => ts('Start Event Adjust Interval'),
247 'description' => ts('Status range begins this many units from start_event.'),
248 'where' => 'civicrm_membership_status.start_event_adjust_interval',
249 'table_name' => 'civicrm_membership_status',
250 'entity' => 'MembershipStatus',
251 'bao' => 'CRM_Member_BAO_MembershipStatus',
252 'localizable' => 0,
253 'add' => '1.5',
254 ],
255 'end_event' => [
256 'name' => 'end_event',
257 'type' => CRM_Utils_Type::T_STRING,
258 'title' => ts('End Event'),
259 'description' => ts('Event after which this status ends.'),
260 'maxlength' => 12,
261 'size' => CRM_Utils_Type::TWELVE,
262 'where' => 'civicrm_membership_status.end_event',
263 'table_name' => 'civicrm_membership_status',
264 'entity' => 'MembershipStatus',
265 'bao' => 'CRM_Member_BAO_MembershipStatus',
266 'localizable' => 0,
267 'html' => [
268 'type' => 'Select',
269 ],
270 'pseudoconstant' => [
271 'callback' => 'CRM_Core_SelectValues::eventDate',
272 ],
273 'add' => '1.5',
274 ],
275 'end_event_adjust_unit' => [
276 'name' => 'end_event_adjust_unit',
277 'type' => CRM_Utils_Type::T_STRING,
278 'title' => ts('End Event Adjust Unit'),
279 'description' => ts('Unit used for adjusting from the ending event.'),
280 'maxlength' => 8,
281 'size' => CRM_Utils_Type::EIGHT,
282 'where' => 'civicrm_membership_status.end_event_adjust_unit',
283 'table_name' => 'civicrm_membership_status',
284 'entity' => 'MembershipStatus',
285 'bao' => 'CRM_Member_BAO_MembershipStatus',
286 'localizable' => 0,
287 'html' => [
288 'type' => 'Select',
289 ],
290 'pseudoconstant' => [
291 'callback' => 'CRM_Core_SelectValues::unitList',
292 ],
293 'add' => '1.5',
294 ],
295 'end_event_adjust_interval' => [
296 'name' => 'end_event_adjust_interval',
297 'type' => CRM_Utils_Type::T_INT,
298 'title' => ts('End Event Adjust Interval'),
299 'description' => ts('Status range ends this many units from end_event.'),
300 'where' => 'civicrm_membership_status.end_event_adjust_interval',
301 'table_name' => 'civicrm_membership_status',
302 'entity' => 'MembershipStatus',
303 'bao' => 'CRM_Member_BAO_MembershipStatus',
304 'localizable' => 0,
305 'add' => '1.5',
306 ],
307 'is_current_member' => [
308 'name' => 'is_current_member',
309 'type' => CRM_Utils_Type::T_BOOLEAN,
310 'title' => ts('Current Membership?'),
311 'description' => ts('Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE).'),
312 'where' => 'civicrm_membership_status.is_current_member',
313 'table_name' => 'civicrm_membership_status',
314 'entity' => 'MembershipStatus',
315 'bao' => 'CRM_Member_BAO_MembershipStatus',
316 'localizable' => 0,
317 'add' => '1.5',
318 ],
319 'is_admin' => [
320 'name' => 'is_admin',
321 'type' => CRM_Utils_Type::T_BOOLEAN,
322 'title' => ts('Administrator Only?'),
323 'description' => ts('Is this status for admin/manual assignment only.'),
324 'where' => 'civicrm_membership_status.is_admin',
325 'table_name' => 'civicrm_membership_status',
326 'entity' => 'MembershipStatus',
327 'bao' => 'CRM_Member_BAO_MembershipStatus',
328 'localizable' => 0,
329 'html' => [
330 'type' => 'CheckBox',
331 ],
332 'add' => '1.5',
333 ],
334 'weight' => [
335 'name' => 'weight',
336 'type' => CRM_Utils_Type::T_INT,
337 'title' => ts('Order'),
338 'where' => 'civicrm_membership_status.weight',
339 'table_name' => 'civicrm_membership_status',
340 'entity' => 'MembershipStatus',
341 'bao' => 'CRM_Member_BAO_MembershipStatus',
342 'localizable' => 0,
343 'add' => '1.5',
344 ],
345 'is_default' => [
346 'name' => 'is_default',
347 'type' => CRM_Utils_Type::T_BOOLEAN,
348 'title' => ts('Default Status?'),
349 'description' => ts('Assign this status to a membership record if no other status match is found.'),
350 'where' => 'civicrm_membership_status.is_default',
351 'table_name' => 'civicrm_membership_status',
352 'entity' => 'MembershipStatus',
353 'bao' => 'CRM_Member_BAO_MembershipStatus',
354 'localizable' => 0,
355 'html' => [
356 'type' => 'CheckBox',
357 ],
358 'add' => '1.5',
359 ],
360 'is_active' => [
361 'name' => 'is_active',
362 'type' => CRM_Utils_Type::T_BOOLEAN,
363 'title' => ts('Is Active'),
364 'description' => ts('Is this membership_status enabled.'),
365 'where' => 'civicrm_membership_status.is_active',
366 'default' => '1',
367 'table_name' => 'civicrm_membership_status',
368 'entity' => 'MembershipStatus',
369 'bao' => 'CRM_Member_BAO_MembershipStatus',
370 'localizable' => 0,
371 'html' => [
372 'type' => 'CheckBox',
373 ],
374 'add' => '1.5',
375 ],
376 'is_reserved' => [
377 'name' => 'is_reserved',
378 'type' => CRM_Utils_Type::T_BOOLEAN,
379 'title' => ts('Is Reserved'),
380 'description' => ts('Is this membership_status reserved.'),
381 'where' => 'civicrm_membership_status.is_reserved',
382 'default' => '0',
383 'table_name' => 'civicrm_membership_status',
384 'entity' => 'MembershipStatus',
385 'bao' => 'CRM_Member_BAO_MembershipStatus',
386 'localizable' => 0,
387 'html' => [
388 'type' => 'CheckBox',
389 ],
390 'add' => '2.1',
391 ],
392 ];
393 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
394 }
395 return Civi::$statics[__CLASS__]['fields'];
396 }
397
398 /**
399 * Return a mapping from field-name to the corresponding key (as used in fields()).
400 *
401 * @return array
402 * Array(string $name => string $uniqueName).
403 */
404 public static function &fieldKeys() {
405 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
406 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
407 }
408 return Civi::$statics[__CLASS__]['fieldKeys'];
409 }
410
411 /**
412 * Returns the names of this table
413 *
414 * @return string
415 */
416 public static function getTableName() {
417 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
418 }
419
420 /**
421 * Returns if this table needs to be logged
422 *
423 * @return bool
424 */
425 public function getLog() {
426 return self::$_log;
427 }
428
429 /**
430 * Returns the list of fields that can be imported
431 *
432 * @param bool $prefix
433 *
434 * @return array
435 */
436 public static function &import($prefix = FALSE) {
437 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_status', $prefix, []);
438 return $r;
439 }
440
441 /**
442 * Returns the list of fields that can be exported
443 *
444 * @param bool $prefix
445 *
446 * @return array
447 */
448 public static function &export($prefix = FALSE) {
449 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_status', $prefix, []);
450 return $r;
451 }
452
453 /**
454 * Returns the list of indices
455 *
456 * @param bool $localize
457 *
458 * @return array
459 */
460 public static function indices($localize = TRUE) {
461 $indices = [];
462 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
463 }
464
465 }