Merge pull request #8735 from eileenmcnaughton/address_tests
[civicrm-core.git] / CRM / Member / DAO / MembershipLog.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Member/MembershipLog.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:0c51f7b8ad368df053d1345e0a20d33a)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_membership_log';
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = true;
51 /**
52 *
53 * @var int unsigned
54 */
55 public $id;
56 /**
57 * FK to Membership table
58 *
59 * @var int unsigned
60 */
61 public $membership_id;
62 /**
63 * New status assigned to membership by this action. FK to Membership Status
64 *
65 * @var int unsigned
66 */
67 public $status_id;
68 /**
69 * New membership period start date
70 *
71 * @var date
72 */
73 public $start_date;
74 /**
75 * New membership period expiration date.
76 *
77 * @var date
78 */
79 public $end_date;
80 /**
81 * FK to Contact ID of person under whose credentials this data modification was made.
82 *
83 * @var int unsigned
84 */
85 public $modified_id;
86 /**
87 * Date this membership modification action was logged.
88 *
89 * @var date
90 */
91 public $modified_date;
92 /**
93 * FK to Membership Type.
94 *
95 * @var int unsigned
96 */
97 public $membership_type_id;
98 /**
99 * Maximum number of related memberships.
100 *
101 * @var int
102 */
103 public $max_related;
104 /**
105 * class constructor
106 *
107 * @return civicrm_membership_log
108 */
109 function __construct() {
110 $this->__table = 'civicrm_membership_log';
111 parent::__construct();
112 }
113 /**
114 * Returns foreign keys and entity references
115 *
116 * @return array
117 * [CRM_Core_Reference_Interface]
118 */
119 static function getReferenceColumns() {
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']);
127 }
128 return Civi::$statics[__CLASS__]['links'];
129 }
130 /**
131 * Returns all the column names of this table
132 *
133 * @return array
134 */
135 static function &fields() {
136 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
137 Civi::$statics[__CLASS__]['fields'] = array(
138 'id' => array(
139 'name' => 'id',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('Membership Log ID') ,
142 'required' => true,
143 ) ,
144 'membership_id' => array(
145 'name' => 'membership_id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Membership ID') ,
148 'description' => 'FK to Membership table',
149 'required' => true,
150 'FKClassName' => 'CRM_Member_DAO_Membership',
151 ) ,
152 'status_id' => array(
153 'name' => 'status_id',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Membership Status') ,
156 'description' => 'New status assigned to membership by this action. FK to Membership Status',
157 'required' => true,
158 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
159 ) ,
160 'start_date' => array(
161 'name' => 'start_date',
162 'type' => CRM_Utils_Type::T_DATE,
163 'title' => ts('Membership Log Start Date') ,
164 'description' => 'New membership period start date',
165 ) ,
166 'end_date' => array(
167 'name' => 'end_date',
168 'type' => CRM_Utils_Type::T_DATE,
169 'title' => ts('Membership Log End Date') ,
170 'description' => 'New membership period expiration date.',
171 ) ,
172 'modified_id' => array(
173 'name' => 'modified_id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Membership Log modified By') ,
176 'description' => 'FK to Contact ID of person under whose credentials this data modification was made.',
177 'FKClassName' => 'CRM_Contact_DAO_Contact',
178 ) ,
179 'modified_date' => array(
180 'name' => 'modified_date',
181 'type' => CRM_Utils_Type::T_DATE,
182 'title' => ts('Membership Change Date') ,
183 'description' => 'Date this membership modification action was logged.',
184 ) ,
185 'membership_type_id' => array(
186 'name' => 'membership_type_id',
187 'type' => CRM_Utils_Type::T_INT,
188 'title' => ts('Membership Type ID') ,
189 'description' => 'FK to Membership Type.',
190 'FKClassName' => 'CRM_Member_DAO_MembershipType',
191 ) ,
192 'max_related' => array(
193 'name' => 'max_related',
194 'type' => CRM_Utils_Type::T_INT,
195 'title' => ts('Maximum Related Memberships') ,
196 'description' => 'Maximum number of related memberships.',
197 ) ,
198 );
199 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
200 }
201 return Civi::$statics[__CLASS__]['fields'];
202 }
203 /**
204 * Return a mapping from field-name to the corresponding key (as used in fields()).
205 *
206 * @return array
207 * Array(string $name => string $uniqueName).
208 */
209 static function &fieldKeys() {
210 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
211 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
212 }
213 return Civi::$statics[__CLASS__]['fieldKeys'];
214 }
215 /**
216 * Returns the names of this table
217 *
218 * @return string
219 */
220 static function getTableName() {
221 return self::$_tableName;
222 }
223 /**
224 * Returns if this table needs to be logged
225 *
226 * @return boolean
227 */
228 function getLog() {
229 return self::$_log;
230 }
231 /**
232 * Returns the list of fields that can be imported
233 *
234 * @param bool $prefix
235 *
236 * @return array
237 */
238 static function &import($prefix = false) {
239 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'membership_log', $prefix, array());
240 return $r;
241 }
242 /**
243 * Returns the list of fields that can be exported
244 *
245 * @param bool $prefix
246 *
247 * @return array
248 */
249 static function &export($prefix = false) {
250 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'membership_log', $prefix, array());
251 return $r;
252 }
253 }