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