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