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