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