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