Merge pull request #22954 from JMAConsulting/booleanFields
[civicrm-core.git] / CRM / Member / DAO / MembershipLog.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/MembershipLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:0064664a5741cb1f9ba8fea392dcef22)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the MembershipLog entity.
f41f0342 14 */
e501603b 15class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.5';
d31fb4e3 18 const COMPONENT = 'CiviMember';
c3fc2621 19
e501603b 20 /**
f41f0342 21 * Static instance to hold the table name.
e501603b
TO
22 *
23 * @var string
24 */
fa45b5b9 25 public static $_tableName = 'civicrm_membership_log';
c3fc2621 26
e501603b 27 /**
f41f0342 28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 29 *
c3fc2621 30 * @var bool
e501603b 31 */
fa45b5b9 32 public static $_log = TRUE;
c3fc2621 33
e501603b 34 /**
28979d65
CW
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
e501603b
TO
38 */
39 public $id;
c3fc2621 40
e501603b
TO
41 /**
42 * FK to Membership table
43 *
28979d65
CW
44 * @var int|string
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
e501603b
TO
47 */
48 public $membership_id;
c3fc2621 49
e501603b
TO
50 /**
51 * New status assigned to membership by this action. FK to Membership Status
52 *
28979d65
CW
53 * @var int|string
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
e501603b
TO
56 */
57 public $status_id;
c3fc2621 58
e501603b
TO
59 /**
60 * New membership period start date
61 *
28979d65
CW
62 * @var string|null
63 * (SQL type: date)
64 * Note that values will be retrieved from the database as a string.
e501603b
TO
65 */
66 public $start_date;
c3fc2621 67
e501603b
TO
68 /**
69 * New membership period expiration date.
70 *
28979d65
CW
71 * @var string|null
72 * (SQL type: date)
73 * Note that values will be retrieved from the database as a string.
e501603b
TO
74 */
75 public $end_date;
c3fc2621 76
e501603b
TO
77 /**
78 * FK to Contact ID of person under whose credentials this data modification was made.
79 *
28979d65
CW
80 * @var int|string|null
81 * (SQL type: int unsigned)
82 * Note that values will be retrieved from the database as a string.
e501603b
TO
83 */
84 public $modified_id;
c3fc2621 85
e501603b
TO
86 /**
87 * Date this membership modification action was logged.
88 *
28979d65
CW
89 * @var string|null
90 * (SQL type: date)
91 * Note that values will be retrieved from the database as a string.
e501603b
TO
92 */
93 public $modified_date;
c3fc2621 94
e501603b
TO
95 /**
96 * FK to Membership Type.
97 *
28979d65
CW
98 * @var int|string|null
99 * (SQL type: int unsigned)
100 * Note that values will be retrieved from the database as a string.
e501603b
TO
101 */
102 public $membership_type_id;
c3fc2621 103
e501603b
TO
104 /**
105 * Maximum number of related memberships.
106 *
28979d65
CW
107 * @var int|string|null
108 * (SQL type: int)
109 * Note that values will be retrieved from the database as a string.
e501603b
TO
110 */
111 public $max_related;
c3fc2621 112
e501603b 113 /**
f41f0342 114 * Class constructor.
e501603b 115 */
c3fc2621 116 public function __construct() {
e501603b
TO
117 $this->__table = 'civicrm_membership_log';
118 parent::__construct();
119 }
c3fc2621 120
449c4e6b
CW
121 /**
122 * Returns localized title of this entity.
7b66c3b5
AH
123 *
124 * @param bool $plural
125 * Whether to return the plural version of the title.
449c4e6b 126 */
7b66c3b5
AH
127 public static function getEntityTitle($plural = FALSE) {
128 return $plural ? ts('Membership Logs') : ts('Membership Log');
449c4e6b
CW
129 }
130
e501603b 131 /**
f41f0342 132 * Returns foreign keys and entity references.
e501603b
TO
133 *
134 * @return array
135 * [CRM_Core_Reference_Interface]
136 */
c3fc2621 137 public static function getReferenceColumns() {
346aaaba 138 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 139 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
140 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_id', 'civicrm_membership', 'id');
141 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'status_id', 'civicrm_membership_status', 'id');
142 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id');
143 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id');
346aaaba 144 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 145 }
346aaaba 146 return Civi::$statics[__CLASS__]['links'];
e501603b 147 }
c3fc2621 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
CW
160 'title' => ts('Membership Log ID'),
161 'required' => TRUE,
a36434b9 162 'where' => 'civicrm_membership_log.id',
522a26c9 163 'table_name' => 'civicrm_membership_log',
164 'entity' => 'MembershipLog',
165 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 166 'localizable' => 0,
2cbbebe8
A
167 'html' => [
168 'type' => 'Number',
169 ],
1fe423d6 170 'readonly' => TRUE,
a9d0587b 171 'add' => '1.5',
c3fc2621
CW
172 ],
173 'membership_id' => [
e501603b
TO
174 'name' => 'membership_id',
175 'type' => CRM_Utils_Type::T_INT,
c3fc2621 176 'title' => ts('Membership ID'),
215b423e 177 'description' => ts('FK to Membership table'),
c3fc2621 178 'required' => TRUE,
a36434b9 179 'where' => 'civicrm_membership_log.membership_id',
522a26c9 180 'table_name' => 'civicrm_membership_log',
181 'entity' => 'MembershipLog',
182 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 183 'localizable' => 0,
e501603b 184 'FKClassName' => 'CRM_Member_DAO_Membership',
2cbbebe8
A
185 'html' => [
186 'label' => ts("Membership"),
187 ],
a9d0587b 188 'add' => '1.5',
c3fc2621
CW
189 ],
190 'status_id' => [
e501603b
TO
191 'name' => 'status_id',
192 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 193 'title' => ts('Membership Status ID'),
215b423e 194 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
c3fc2621 195 'required' => TRUE,
a36434b9 196 'where' => 'civicrm_membership_log.status_id',
522a26c9 197 'table_name' => 'civicrm_membership_log',
198 'entity' => 'MembershipLog',
199 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 200 'localizable' => 0,
e501603b 201 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
2cbbebe8
A
202 'html' => [
203 'label' => ts("Membership Status"),
204 ],
a9d0587b 205 'add' => '1.5',
c3fc2621
CW
206 ],
207 'start_date' => [
e501603b
TO
208 'name' => 'start_date',
209 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 210 'title' => ts('Membership Log Start Date'),
215b423e 211 'description' => ts('New membership period start date'),
a36434b9 212 'where' => 'civicrm_membership_log.start_date',
213 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
522a26c9 214 'table_name' => 'civicrm_membership_log',
215 'entity' => 'MembershipLog',
216 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 217 'localizable' => 0,
a9d0587b 218 'add' => '1.5',
c3fc2621
CW
219 ],
220 'end_date' => [
e501603b
TO
221 'name' => 'end_date',
222 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 223 'title' => ts('Membership Log End Date'),
215b423e 224 'description' => ts('New membership period expiration date.'),
a36434b9 225 'where' => 'civicrm_membership_log.end_date',
226 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
522a26c9 227 'table_name' => 'civicrm_membership_log',
228 'entity' => 'MembershipLog',
229 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 230 'localizable' => 0,
a9d0587b 231 'add' => '1.5',
c3fc2621
CW
232 ],
233 'modified_id' => [
e501603b
TO
234 'name' => 'modified_id',
235 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 236 'title' => ts('Modified By Contact ID'),
215b423e 237 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
a36434b9 238 'where' => 'civicrm_membership_log.modified_id',
522a26c9 239 'table_name' => 'civicrm_membership_log',
240 'entity' => 'MembershipLog',
241 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 242 'localizable' => 0,
e501603b 243 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
244 'html' => [
245 'label' => ts("Modified By"),
246 ],
a0e733f3 247 'readonly' => TRUE,
a9d0587b 248 'add' => '1.5',
c3fc2621
CW
249 ],
250 'modified_date' => [
e501603b
TO
251 'name' => 'modified_date',
252 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 253 'title' => ts('Membership Change Date'),
215b423e 254 'description' => ts('Date this membership modification action was logged.'),
a36434b9 255 'where' => 'civicrm_membership_log.modified_date',
256 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
522a26c9 257 'table_name' => 'civicrm_membership_log',
258 'entity' => 'MembershipLog',
259 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 260 'localizable' => 0,
a9d0587b 261 'add' => '1.5',
c3fc2621
CW
262 ],
263 'membership_type_id' => [
e501603b
TO
264 'name' => 'membership_type_id',
265 'type' => CRM_Utils_Type::T_INT,
c3fc2621 266 'title' => ts('Membership Type ID'),
215b423e 267 'description' => ts('FK to Membership Type.'),
a36434b9 268 'where' => 'civicrm_membership_log.membership_type_id',
522a26c9 269 'table_name' => 'civicrm_membership_log',
270 'entity' => 'MembershipLog',
271 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 272 'localizable' => 0,
e501603b 273 'FKClassName' => 'CRM_Member_DAO_MembershipType',
2cbbebe8
A
274 'html' => [
275 'label' => ts("Membership Type"),
276 ],
a9d0587b 277 'add' => '3.4',
c3fc2621
CW
278 ],
279 'max_related' => [
e501603b
TO
280 'name' => 'max_related',
281 'type' => CRM_Utils_Type::T_INT,
c3fc2621 282 'title' => ts('Maximum Related Memberships'),
215b423e 283 'description' => ts('Maximum number of related memberships.'),
a36434b9 284 'where' => 'civicrm_membership_log.max_related',
522a26c9 285 'table_name' => 'civicrm_membership_log',
286 'entity' => 'MembershipLog',
287 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 288 'localizable' => 0,
a9d0587b 289 'add' => '4.3',
c3fc2621
CW
290 ],
291 ];
346aaaba 292 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 293 }
346aaaba 294 return Civi::$statics[__CLASS__]['fields'];
e501603b 295 }
c3fc2621 296
e501603b 297 /**
bd8e0b14 298 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
299 *
300 * @return array
bd8e0b14 301 * Array(string $name => string $uniqueName).
e501603b 302 */
c3fc2621 303 public static function &fieldKeys() {
bd8e0b14
TO
304 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
305 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 306 }
bd8e0b14 307 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 308 }
c3fc2621 309
e501603b
TO
310 /**
311 * Returns the names of this table
312 *
313 * @return string
314 */
c3fc2621 315 public static function getTableName() {
e501603b
TO
316 return self::$_tableName;
317 }
c3fc2621 318
e501603b
TO
319 /**
320 * Returns if this table needs to be logged
321 *
c3fc2621 322 * @return bool
e501603b 323 */
c3fc2621 324 public function getLog() {
e501603b
TO
325 return self::$_log;
326 }
c3fc2621 327
e501603b
TO
328 /**
329 * Returns the list of fields that can be imported
330 *
331 * @param bool $prefix
332 *
333 * @return array
334 */
c3fc2621
CW
335 public static function &import($prefix = FALSE) {
336 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_log', $prefix, []);
60808919 337 return $r;
e501603b 338 }
c3fc2621 339
e501603b
TO
340 /**
341 * Returns the list of fields that can be exported
342 *
343 * @param bool $prefix
344 *
345 * @return array
346 */
c3fc2621
CW
347 public static function &export($prefix = FALSE) {
348 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_log', $prefix, []);
60808919 349 return $r;
e501603b 350 }
c3fc2621 351
e7a6b91a
AS
352 /**
353 * Returns the list of indices
c3fc2621
CW
354 *
355 * @param bool $localize
356 *
357 * @return array
e7a6b91a
AS
358 */
359 public static function indices($localize = TRUE) {
c3fc2621 360 $indices = [];
e7a6b91a
AS
361 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
362 }
c3fc2621 363
e501603b 364}