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