5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Member/MembershipLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:82b26091e0c62f81060ae15de5a4a010)
13 * Database access object for the MembershipLog entity.
15 class CRM_Member_DAO_MembershipLog
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_membership_log';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
37 * FK to Membership table
41 public $membership_id;
44 * New status assigned to membership by this action. FK to Membership Status
51 * New membership period start date
58 * New membership period expiration date.
65 * FK to Contact ID of person under whose credentials this data modification was made.
72 * Date this membership modification action was logged.
76 public $modified_date;
79 * FK to Membership Type.
83 public $membership_type_id;
86 * Maximum number of related memberships.
95 public function __construct() {
96 $this->__table
= 'civicrm_membership_log';
97 parent
::__construct();
101 * Returns foreign keys and entity references.
104 * [CRM_Core_Reference_Interface]
106 public static function getReferenceColumns() {
107 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
108 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
113 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
115 return Civi
::$statics[__CLASS__
]['links'];
119 * Returns all the column names of this table
123 public static function &fields() {
124 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
125 Civi
::$statics[__CLASS__
]['fields'] = [
128 'type' => CRM_Utils_Type
::T_INT
,
129 'title' => ts('Membership Log ID'),
131 'where' => 'civicrm_membership_log.id',
132 'table_name' => 'civicrm_membership_log',
133 'entity' => 'MembershipLog',
134 'bao' => 'CRM_Member_BAO_MembershipLog',
138 'name' => 'membership_id',
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('Membership ID'),
141 'description' => ts('FK to Membership table'),
143 'where' => 'civicrm_membership_log.membership_id',
144 'table_name' => 'civicrm_membership_log',
145 'entity' => 'MembershipLog',
146 'bao' => 'CRM_Member_BAO_MembershipLog',
148 'FKClassName' => 'CRM_Member_DAO_Membership',
151 'name' => 'status_id',
152 'type' => CRM_Utils_Type
::T_INT
,
153 'title' => ts('Membership Status'),
154 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
156 'where' => 'civicrm_membership_log.status_id',
157 'table_name' => 'civicrm_membership_log',
158 'entity' => 'MembershipLog',
159 'bao' => 'CRM_Member_BAO_MembershipLog',
161 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
164 'name' => 'start_date',
165 'type' => CRM_Utils_Type
::T_DATE
,
166 'title' => ts('Membership Log Start Date'),
167 'description' => ts('New membership period start date'),
168 'where' => 'civicrm_membership_log.start_date',
169 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
170 'table_name' => 'civicrm_membership_log',
171 'entity' => 'MembershipLog',
172 'bao' => 'CRM_Member_BAO_MembershipLog',
176 'name' => 'end_date',
177 'type' => CRM_Utils_Type
::T_DATE
,
178 'title' => ts('Membership Log End Date'),
179 'description' => ts('New membership period expiration date.'),
180 'where' => 'civicrm_membership_log.end_date',
181 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
182 'table_name' => 'civicrm_membership_log',
183 'entity' => 'MembershipLog',
184 'bao' => 'CRM_Member_BAO_MembershipLog',
188 'name' => 'modified_id',
189 'type' => CRM_Utils_Type
::T_INT
,
190 'title' => ts('Membership Log modified By'),
191 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
192 'where' => 'civicrm_membership_log.modified_id',
193 'table_name' => 'civicrm_membership_log',
194 'entity' => 'MembershipLog',
195 'bao' => 'CRM_Member_BAO_MembershipLog',
197 'FKClassName' => 'CRM_Contact_DAO_Contact',
200 'name' => 'modified_date',
201 'type' => CRM_Utils_Type
::T_DATE
,
202 'title' => ts('Membership Change Date'),
203 'description' => ts('Date this membership modification action was logged.'),
204 'where' => 'civicrm_membership_log.modified_date',
205 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
206 'table_name' => 'civicrm_membership_log',
207 'entity' => 'MembershipLog',
208 'bao' => 'CRM_Member_BAO_MembershipLog',
211 'membership_type_id' => [
212 'name' => 'membership_type_id',
213 'type' => CRM_Utils_Type
::T_INT
,
214 'title' => ts('Membership Type ID'),
215 'description' => ts('FK to Membership Type.'),
216 'where' => 'civicrm_membership_log.membership_type_id',
217 'table_name' => 'civicrm_membership_log',
218 'entity' => 'MembershipLog',
219 'bao' => 'CRM_Member_BAO_MembershipLog',
221 'FKClassName' => 'CRM_Member_DAO_MembershipType',
224 'name' => 'max_related',
225 'type' => CRM_Utils_Type
::T_INT
,
226 'title' => ts('Maximum Related Memberships'),
227 'description' => ts('Maximum number of related memberships.'),
228 'where' => 'civicrm_membership_log.max_related',
229 'table_name' => 'civicrm_membership_log',
230 'entity' => 'MembershipLog',
231 'bao' => 'CRM_Member_BAO_MembershipLog',
235 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
237 return Civi
::$statics[__CLASS__
]['fields'];
241 * Return a mapping from field-name to the corresponding key (as used in fields()).
244 * Array(string $name => string $uniqueName).
246 public static function &fieldKeys() {
247 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
248 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
250 return Civi
::$statics[__CLASS__
]['fieldKeys'];
254 * Returns the names of this table
258 public static function getTableName() {
259 return self
::$_tableName;
263 * Returns if this table needs to be logged
267 public function getLog() {
272 * Returns the list of fields that can be imported
274 * @param bool $prefix
278 public static function &import($prefix = FALSE) {
279 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_log', $prefix, []);
284 * Returns the list of fields that can be exported
286 * @param bool $prefix
290 public static function &export($prefix = FALSE) {
291 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_log', $prefix, []);
296 * Returns the list of indices
298 * @param bool $localize
302 public static function indices($localize = TRUE) {
304 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;