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