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