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 | |
2cbbebe8 | 9 | * (GenCodeChecksum:51fef54a2bde11340084707688a511bf) |
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 | ], | |
a9d0587b | 152 | 'add' => '1.5', |
c3fc2621 CW |
153 | ], |
154 | 'membership_id' => [ | |
e501603b TO |
155 | 'name' => 'membership_id', |
156 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 157 | 'title' => ts('Membership ID'), |
215b423e | 158 | 'description' => ts('FK to Membership table'), |
c3fc2621 | 159 | 'required' => TRUE, |
a36434b9 | 160 | 'where' => 'civicrm_membership_log.membership_id', |
522a26c9 | 161 | 'table_name' => 'civicrm_membership_log', |
162 | 'entity' => 'MembershipLog', | |
163 | 'bao' => 'CRM_Member_BAO_MembershipLog', | |
6a7e5e5d | 164 | 'localizable' => 0, |
e501603b | 165 | 'FKClassName' => 'CRM_Member_DAO_Membership', |
2cbbebe8 A |
166 | 'html' => [ |
167 | 'label' => ts("Membership"), | |
168 | ], | |
a9d0587b | 169 | 'add' => '1.5', |
c3fc2621 CW |
170 | ], |
171 | 'status_id' => [ | |
e501603b TO |
172 | 'name' => 'status_id', |
173 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 174 | 'title' => ts('Membership Status ID'), |
215b423e | 175 | 'description' => ts('New status assigned to membership by this action. FK to Membership Status'), |
c3fc2621 | 176 | 'required' => TRUE, |
a36434b9 | 177 | 'where' => 'civicrm_membership_log.status_id', |
522a26c9 | 178 | 'table_name' => 'civicrm_membership_log', |
179 | 'entity' => 'MembershipLog', | |
180 | 'bao' => 'CRM_Member_BAO_MembershipLog', | |
6a7e5e5d | 181 | 'localizable' => 0, |
e501603b | 182 | 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', |
2cbbebe8 A |
183 | 'html' => [ |
184 | 'label' => ts("Membership Status"), | |
185 | ], | |
a9d0587b | 186 | 'add' => '1.5', |
c3fc2621 CW |
187 | ], |
188 | 'start_date' => [ | |
e501603b TO |
189 | 'name' => 'start_date', |
190 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 191 | 'title' => ts('Membership Log Start Date'), |
215b423e | 192 | 'description' => ts('New membership period start date'), |
a36434b9 | 193 | 'where' => 'civicrm_membership_log.start_date', |
194 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
522a26c9 | 195 | 'table_name' => 'civicrm_membership_log', |
196 | 'entity' => 'MembershipLog', | |
197 | 'bao' => 'CRM_Member_BAO_MembershipLog', | |
6a7e5e5d | 198 | 'localizable' => 0, |
a9d0587b | 199 | 'add' => '1.5', |
c3fc2621 CW |
200 | ], |
201 | 'end_date' => [ | |
e501603b TO |
202 | 'name' => 'end_date', |
203 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 204 | 'title' => ts('Membership Log End Date'), |
215b423e | 205 | 'description' => ts('New membership period expiration date.'), |
a36434b9 | 206 | 'where' => 'civicrm_membership_log.end_date', |
207 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
522a26c9 | 208 | 'table_name' => 'civicrm_membership_log', |
209 | 'entity' => 'MembershipLog', | |
210 | 'bao' => 'CRM_Member_BAO_MembershipLog', | |
6a7e5e5d | 211 | 'localizable' => 0, |
a9d0587b | 212 | 'add' => '1.5', |
c3fc2621 CW |
213 | ], |
214 | 'modified_id' => [ | |
e501603b TO |
215 | 'name' => 'modified_id', |
216 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 217 | 'title' => ts('Modified By Contact ID'), |
215b423e | 218 | 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'), |
a36434b9 | 219 | 'where' => 'civicrm_membership_log.modified_id', |
522a26c9 | 220 | 'table_name' => 'civicrm_membership_log', |
221 | 'entity' => 'MembershipLog', | |
222 | 'bao' => 'CRM_Member_BAO_MembershipLog', | |
6a7e5e5d | 223 | 'localizable' => 0, |
e501603b | 224 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
225 | 'html' => [ |
226 | 'label' => ts("Modified By"), | |
227 | ], | |
a9d0587b | 228 | 'add' => '1.5', |
c3fc2621 CW |
229 | ], |
230 | 'modified_date' => [ | |
e501603b TO |
231 | 'name' => 'modified_date', |
232 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 233 | 'title' => ts('Membership Change Date'), |
215b423e | 234 | 'description' => ts('Date this membership modification action was logged.'), |
a36434b9 | 235 | 'where' => 'civicrm_membership_log.modified_date', |
236 | 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', | |
522a26c9 | 237 | 'table_name' => 'civicrm_membership_log', |
238 | 'entity' => 'MembershipLog', | |
239 | 'bao' => 'CRM_Member_BAO_MembershipLog', | |
6a7e5e5d | 240 | 'localizable' => 0, |
a9d0587b | 241 | 'add' => '1.5', |
c3fc2621 CW |
242 | ], |
243 | 'membership_type_id' => [ | |
e501603b TO |
244 | 'name' => 'membership_type_id', |
245 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 246 | 'title' => ts('Membership Type ID'), |
215b423e | 247 | 'description' => ts('FK to Membership Type.'), |
a36434b9 | 248 | 'where' => 'civicrm_membership_log.membership_type_id', |
522a26c9 | 249 | 'table_name' => 'civicrm_membership_log', |
250 | 'entity' => 'MembershipLog', | |
251 | 'bao' => 'CRM_Member_BAO_MembershipLog', | |
6a7e5e5d | 252 | 'localizable' => 0, |
e501603b | 253 | 'FKClassName' => 'CRM_Member_DAO_MembershipType', |
2cbbebe8 A |
254 | 'html' => [ |
255 | 'label' => ts("Membership Type"), | |
256 | ], | |
a9d0587b | 257 | 'add' => '3.4', |
c3fc2621 CW |
258 | ], |
259 | 'max_related' => [ | |
e501603b TO |
260 | 'name' => 'max_related', |
261 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 262 | 'title' => ts('Maximum Related Memberships'), |
215b423e | 263 | 'description' => ts('Maximum number of related memberships.'), |
a36434b9 | 264 | 'where' => 'civicrm_membership_log.max_related', |
522a26c9 | 265 | 'table_name' => 'civicrm_membership_log', |
266 | 'entity' => 'MembershipLog', | |
267 | 'bao' => 'CRM_Member_BAO_MembershipLog', | |
6a7e5e5d | 268 | 'localizable' => 0, |
a9d0587b | 269 | 'add' => '4.3', |
c3fc2621 CW |
270 | ], |
271 | ]; | |
346aaaba | 272 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 273 | } |
346aaaba | 274 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 275 | } |
c3fc2621 | 276 | |
e501603b | 277 | /** |
bd8e0b14 | 278 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
279 | * |
280 | * @return array | |
bd8e0b14 | 281 | * Array(string $name => string $uniqueName). |
e501603b | 282 | */ |
c3fc2621 | 283 | public static function &fieldKeys() { |
bd8e0b14 TO |
284 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
285 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 286 | } |
bd8e0b14 | 287 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 288 | } |
c3fc2621 | 289 | |
e501603b TO |
290 | /** |
291 | * Returns the names of this table | |
292 | * | |
293 | * @return string | |
294 | */ | |
c3fc2621 | 295 | public static function getTableName() { |
e501603b TO |
296 | return self::$_tableName; |
297 | } | |
c3fc2621 | 298 | |
e501603b TO |
299 | /** |
300 | * Returns if this table needs to be logged | |
301 | * | |
c3fc2621 | 302 | * @return bool |
e501603b | 303 | */ |
c3fc2621 | 304 | public function getLog() { |
e501603b TO |
305 | return self::$_log; |
306 | } | |
c3fc2621 | 307 | |
e501603b TO |
308 | /** |
309 | * Returns the list of fields that can be imported | |
310 | * | |
311 | * @param bool $prefix | |
312 | * | |
313 | * @return array | |
314 | */ | |
c3fc2621 CW |
315 | public static function &import($prefix = FALSE) { |
316 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_log', $prefix, []); | |
60808919 | 317 | return $r; |
e501603b | 318 | } |
c3fc2621 | 319 | |
e501603b TO |
320 | /** |
321 | * Returns the list of fields that can be exported | |
322 | * | |
323 | * @param bool $prefix | |
324 | * | |
325 | * @return array | |
326 | */ | |
c3fc2621 CW |
327 | public static function &export($prefix = FALSE) { |
328 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_log', $prefix, []); | |
60808919 | 329 | return $r; |
e501603b | 330 | } |
c3fc2621 | 331 | |
e7a6b91a AS |
332 | /** |
333 | * Returns the list of indices | |
c3fc2621 CW |
334 | * |
335 | * @param bool $localize | |
336 | * | |
337 | * @return array | |
e7a6b91a AS |
338 | */ |
339 | public static function indices($localize = TRUE) { | |
c3fc2621 | 340 | $indices = []; |
e7a6b91a AS |
341 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
342 | } | |
c3fc2621 | 343 | |
e501603b | 344 | } |