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