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