Merge pull request #18176 from agileware/CIVICRM-1465
[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:4d5744b433ca7bb5385b11945cc0fe10)
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 public static function getEntityTitle() {
106 return ts('Membership Logs');
107 }
108
109 /**
110 * Returns foreign keys and entity references.
111 *
112 * @return array
113 * [CRM_Core_Reference_Interface]
114 */
115 public static function getReferenceColumns() {
116 if (!isset(Civi::$statics[__CLASS__]['links'])) {
117 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
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');
122 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
123 }
124 return Civi::$statics[__CLASS__]['links'];
125 }
126
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
132 public static function &fields() {
133 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
134 Civi::$statics[__CLASS__]['fields'] = [
135 'id' => [
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Membership Log ID'),
139 'required' => TRUE,
140 'where' => 'civicrm_membership_log.id',
141 'table_name' => 'civicrm_membership_log',
142 'entity' => 'MembershipLog',
143 'bao' => 'CRM_Member_BAO_MembershipLog',
144 'localizable' => 0,
145 'add' => '1.5',
146 ],
147 'membership_id' => [
148 'name' => 'membership_id',
149 'type' => CRM_Utils_Type::T_INT,
150 'title' => ts('Membership ID'),
151 'description' => ts('FK to Membership table'),
152 'required' => TRUE,
153 'where' => 'civicrm_membership_log.membership_id',
154 'table_name' => 'civicrm_membership_log',
155 'entity' => 'MembershipLog',
156 'bao' => 'CRM_Member_BAO_MembershipLog',
157 'localizable' => 0,
158 'FKClassName' => 'CRM_Member_DAO_Membership',
159 'add' => '1.5',
160 ],
161 'status_id' => [
162 'name' => 'status_id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('Membership Status'),
165 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
166 'required' => TRUE,
167 'where' => 'civicrm_membership_log.status_id',
168 'table_name' => 'civicrm_membership_log',
169 'entity' => 'MembershipLog',
170 'bao' => 'CRM_Member_BAO_MembershipLog',
171 'localizable' => 0,
172 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
173 'add' => '1.5',
174 ],
175 'start_date' => [
176 'name' => 'start_date',
177 'type' => CRM_Utils_Type::T_DATE,
178 'title' => ts('Membership Log Start Date'),
179 'description' => ts('New membership period start date'),
180 'where' => 'civicrm_membership_log.start_date',
181 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
182 'table_name' => 'civicrm_membership_log',
183 'entity' => 'MembershipLog',
184 'bao' => 'CRM_Member_BAO_MembershipLog',
185 'localizable' => 0,
186 'add' => '1.5',
187 ],
188 'end_date' => [
189 'name' => 'end_date',
190 'type' => CRM_Utils_Type::T_DATE,
191 'title' => ts('Membership Log End Date'),
192 'description' => ts('New membership period expiration date.'),
193 'where' => 'civicrm_membership_log.end_date',
194 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
195 'table_name' => 'civicrm_membership_log',
196 'entity' => 'MembershipLog',
197 'bao' => 'CRM_Member_BAO_MembershipLog',
198 'localizable' => 0,
199 'add' => '1.5',
200 ],
201 'modified_id' => [
202 'name' => 'modified_id',
203 'type' => CRM_Utils_Type::T_INT,
204 'title' => ts('Membership Log modified By'),
205 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
206 'where' => 'civicrm_membership_log.modified_id',
207 'table_name' => 'civicrm_membership_log',
208 'entity' => 'MembershipLog',
209 'bao' => 'CRM_Member_BAO_MembershipLog',
210 'localizable' => 0,
211 'FKClassName' => 'CRM_Contact_DAO_Contact',
212 'add' => '1.5',
213 ],
214 'modified_date' => [
215 'name' => 'modified_date',
216 'type' => CRM_Utils_Type::T_DATE,
217 'title' => ts('Membership Change Date'),
218 'description' => ts('Date this membership modification action was logged.'),
219 'where' => 'civicrm_membership_log.modified_date',
220 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
221 'table_name' => 'civicrm_membership_log',
222 'entity' => 'MembershipLog',
223 'bao' => 'CRM_Member_BAO_MembershipLog',
224 'localizable' => 0,
225 'add' => '1.5',
226 ],
227 'membership_type_id' => [
228 'name' => 'membership_type_id',
229 'type' => CRM_Utils_Type::T_INT,
230 'title' => ts('Membership Type ID'),
231 'description' => ts('FK to Membership Type.'),
232 'where' => 'civicrm_membership_log.membership_type_id',
233 'table_name' => 'civicrm_membership_log',
234 'entity' => 'MembershipLog',
235 'bao' => 'CRM_Member_BAO_MembershipLog',
236 'localizable' => 0,
237 'FKClassName' => 'CRM_Member_DAO_MembershipType',
238 'add' => '3.4',
239 ],
240 'max_related' => [
241 'name' => 'max_related',
242 'type' => CRM_Utils_Type::T_INT,
243 'title' => ts('Maximum Related Memberships'),
244 'description' => ts('Maximum number of related memberships.'),
245 'where' => 'civicrm_membership_log.max_related',
246 'table_name' => 'civicrm_membership_log',
247 'entity' => 'MembershipLog',
248 'bao' => 'CRM_Member_BAO_MembershipLog',
249 'localizable' => 0,
250 'add' => '4.3',
251 ],
252 ];
253 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
254 }
255 return Civi::$statics[__CLASS__]['fields'];
256 }
257
258 /**
259 * Return a mapping from field-name to the corresponding key (as used in fields()).
260 *
261 * @return array
262 * Array(string $name => string $uniqueName).
263 */
264 public static function &fieldKeys() {
265 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
266 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
267 }
268 return Civi::$statics[__CLASS__]['fieldKeys'];
269 }
270
271 /**
272 * Returns the names of this table
273 *
274 * @return string
275 */
276 public static function getTableName() {
277 return self::$_tableName;
278 }
279
280 /**
281 * Returns if this table needs to be logged
282 *
283 * @return bool
284 */
285 public function getLog() {
286 return self::$_log;
287 }
288
289 /**
290 * Returns the list of fields that can be imported
291 *
292 * @param bool $prefix
293 *
294 * @return array
295 */
296 public static function &import($prefix = FALSE) {
297 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_log', $prefix, []);
298 return $r;
299 }
300
301 /**
302 * Returns the list of fields that can be exported
303 *
304 * @param bool $prefix
305 *
306 * @return array
307 */
308 public static function &export($prefix = FALSE) {
309 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_log', $prefix, []);
310 return $r;
311 }
312
313 /**
314 * Returns the list of indices
315 *
316 * @param bool $localize
317 *
318 * @return array
319 */
320 public static function indices($localize = TRUE) {
321 $indices = [];
322 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
323 }
324
325 }