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