Merge pull request #15020 from MegaphoneJon/core-1182-517
[civicrm-core.git] / CRM / Member / DAO / MembershipLog.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Member/MembershipLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
74db51d3 9 * (GenCodeChecksum:7e7992e145cb104f8fddaac2a7f60c99)
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 */
fa45b5b9 22 public 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 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b 31 /**
e6ca0a57 32 * @var int
e501603b
TO
33 */
34 public $id;
c3fc2621 35
e501603b
TO
36 /**
37 * FK to Membership table
38 *
e6ca0a57 39 * @var int
e501603b
TO
40 */
41 public $membership_id;
c3fc2621 42
e501603b
TO
43 /**
44 * New status assigned to membership by this action. FK to Membership Status
45 *
e6ca0a57 46 * @var int
e501603b
TO
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 *
e6ca0a57 67 * @var int
e501603b
TO
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 *
e6ca0a57 81 * @var int
e501603b
TO
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 107 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 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,
a36434b9 131 'where' => 'civicrm_membership_log.id',
522a26c9 132 'table_name' => 'civicrm_membership_log',
133 'entity' => 'MembershipLog',
134 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 135 'localizable' => 0,
c3fc2621
CW
136 ],
137 'membership_id' => [
e501603b
TO
138 'name' => 'membership_id',
139 'type' => CRM_Utils_Type::T_INT,
c3fc2621 140 'title' => ts('Membership ID'),
215b423e 141 'description' => ts('FK to Membership table'),
c3fc2621 142 'required' => TRUE,
a36434b9 143 'where' => 'civicrm_membership_log.membership_id',
522a26c9 144 'table_name' => 'civicrm_membership_log',
145 'entity' => 'MembershipLog',
146 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 147 'localizable' => 0,
e501603b 148 'FKClassName' => 'CRM_Member_DAO_Membership',
c3fc2621
CW
149 ],
150 'status_id' => [
e501603b
TO
151 'name' => 'status_id',
152 'type' => CRM_Utils_Type::T_INT,
c3fc2621 153 'title' => ts('Membership Status'),
215b423e 154 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
c3fc2621 155 'required' => TRUE,
a36434b9 156 'where' => 'civicrm_membership_log.status_id',
522a26c9 157 'table_name' => 'civicrm_membership_log',
158 'entity' => 'MembershipLog',
159 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 160 'localizable' => 0,
e501603b 161 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
c3fc2621
CW
162 ],
163 'start_date' => [
e501603b
TO
164 'name' => 'start_date',
165 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 166 'title' => ts('Membership Log Start Date'),
215b423e 167 'description' => ts('New membership period start date'),
a36434b9 168 'where' => 'civicrm_membership_log.start_date',
169 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
522a26c9 170 'table_name' => 'civicrm_membership_log',
171 'entity' => 'MembershipLog',
172 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 173 'localizable' => 0,
c3fc2621
CW
174 ],
175 'end_date' => [
e501603b
TO
176 'name' => 'end_date',
177 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 178 'title' => ts('Membership Log End Date'),
215b423e 179 'description' => ts('New membership period expiration date.'),
a36434b9 180 'where' => 'civicrm_membership_log.end_date',
181 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
522a26c9 182 'table_name' => 'civicrm_membership_log',
183 'entity' => 'MembershipLog',
184 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 185 'localizable' => 0,
c3fc2621
CW
186 ],
187 'modified_id' => [
e501603b
TO
188 'name' => 'modified_id',
189 'type' => CRM_Utils_Type::T_INT,
c3fc2621 190 'title' => ts('Membership Log modified By'),
215b423e 191 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
a36434b9 192 'where' => 'civicrm_membership_log.modified_id',
522a26c9 193 'table_name' => 'civicrm_membership_log',
194 'entity' => 'MembershipLog',
195 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 196 'localizable' => 0,
e501603b 197 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
198 ],
199 'modified_date' => [
e501603b
TO
200 'name' => 'modified_date',
201 'type' => CRM_Utils_Type::T_DATE,
c3fc2621 202 'title' => ts('Membership Change Date'),
215b423e 203 'description' => ts('Date this membership modification action was logged.'),
a36434b9 204 'where' => 'civicrm_membership_log.modified_date',
205 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
522a26c9 206 'table_name' => 'civicrm_membership_log',
207 'entity' => 'MembershipLog',
208 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 209 'localizable' => 0,
c3fc2621
CW
210 ],
211 'membership_type_id' => [
e501603b
TO
212 'name' => 'membership_type_id',
213 'type' => CRM_Utils_Type::T_INT,
c3fc2621 214 'title' => ts('Membership Type ID'),
215b423e 215 'description' => ts('FK to Membership Type.'),
a36434b9 216 'where' => 'civicrm_membership_log.membership_type_id',
522a26c9 217 'table_name' => 'civicrm_membership_log',
218 'entity' => 'MembershipLog',
219 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 220 'localizable' => 0,
e501603b 221 'FKClassName' => 'CRM_Member_DAO_MembershipType',
c3fc2621
CW
222 ],
223 'max_related' => [
e501603b
TO
224 'name' => 'max_related',
225 'type' => CRM_Utils_Type::T_INT,
c3fc2621 226 'title' => ts('Maximum Related Memberships'),
215b423e 227 'description' => ts('Maximum number of related memberships.'),
a36434b9 228 'where' => 'civicrm_membership_log.max_related',
522a26c9 229 'table_name' => 'civicrm_membership_log',
230 'entity' => 'MembershipLog',
231 'bao' => 'CRM_Member_BAO_MembershipLog',
6a7e5e5d 232 'localizable' => 0,
c3fc2621
CW
233 ],
234 ];
346aaaba 235 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 236 }
346aaaba 237 return Civi::$statics[__CLASS__]['fields'];
e501603b 238 }
c3fc2621 239
e501603b 240 /**
bd8e0b14 241 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
242 *
243 * @return array
bd8e0b14 244 * Array(string $name => string $uniqueName).
e501603b 245 */
c3fc2621 246 public static function &fieldKeys() {
bd8e0b14
TO
247 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
248 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 249 }
bd8e0b14 250 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 251 }
c3fc2621 252
e501603b
TO
253 /**
254 * Returns the names of this table
255 *
256 * @return string
257 */
c3fc2621 258 public static function getTableName() {
e501603b
TO
259 return self::$_tableName;
260 }
c3fc2621 261
e501603b
TO
262 /**
263 * Returns if this table needs to be logged
264 *
c3fc2621 265 * @return bool
e501603b 266 */
c3fc2621 267 public function getLog() {
e501603b
TO
268 return self::$_log;
269 }
c3fc2621 270
e501603b
TO
271 /**
272 * Returns the list of fields that can be imported
273 *
274 * @param bool $prefix
275 *
276 * @return array
277 */
c3fc2621
CW
278 public static function &import($prefix = FALSE) {
279 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_log', $prefix, []);
60808919 280 return $r;
e501603b 281 }
c3fc2621 282
e501603b
TO
283 /**
284 * Returns the list of fields that can be exported
285 *
286 * @param bool $prefix
287 *
288 * @return array
289 */
c3fc2621
CW
290 public static function &export($prefix = FALSE) {
291 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_log', $prefix, []);
60808919 292 return $r;
e501603b 293 }
c3fc2621 294
e7a6b91a
AS
295 /**
296 * Returns the list of indices
c3fc2621
CW
297 *
298 * @param bool $localize
299 *
300 * @return array
e7a6b91a
AS
301 */
302 public static function indices($localize = TRUE) {
c3fc2621 303 $indices = [];
e7a6b91a
AS
304 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
305 }
c3fc2621 306
e501603b 307}