5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Member/MembershipLog.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ff966b7edcdd126ddef1ee3b3f3bff2f)
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 localized title of this entity.
103 public static function getEntityTitle() {
104 return ts('Membership Logs');
108 * Returns foreign keys and entity references.
111 * [CRM_Core_Reference_Interface]
113 public static function getReferenceColumns() {
114 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
115 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
116 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_id', 'civicrm_membership', 'id');
117 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'status_id', 'civicrm_membership_status', 'id');
118 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
119 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id');
120 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
122 return Civi
::$statics[__CLASS__
]['links'];
126 * Returns all the column names of this table
130 public static function &fields() {
131 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
132 Civi
::$statics[__CLASS__
]['fields'] = [
135 'type' => CRM_Utils_Type
::T_INT
,
136 'title' => ts('Membership Log ID'),
138 'where' => 'civicrm_membership_log.id',
139 'table_name' => 'civicrm_membership_log',
140 'entity' => 'MembershipLog',
141 'bao' => 'CRM_Member_BAO_MembershipLog',
146 'name' => 'membership_id',
147 'type' => CRM_Utils_Type
::T_INT
,
148 'title' => ts('Membership ID'),
149 'description' => ts('FK to Membership table'),
151 'where' => 'civicrm_membership_log.membership_id',
152 'table_name' => 'civicrm_membership_log',
153 'entity' => 'MembershipLog',
154 'bao' => 'CRM_Member_BAO_MembershipLog',
156 'FKClassName' => 'CRM_Member_DAO_Membership',
160 'name' => 'status_id',
161 'type' => CRM_Utils_Type
::T_INT
,
162 'title' => ts('Membership Status'),
163 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
165 'where' => 'civicrm_membership_log.status_id',
166 'table_name' => 'civicrm_membership_log',
167 'entity' => 'MembershipLog',
168 'bao' => 'CRM_Member_BAO_MembershipLog',
170 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
174 'name' => 'start_date',
175 'type' => CRM_Utils_Type
::T_DATE
,
176 'title' => ts('Membership Log Start Date'),
177 'description' => ts('New membership period start date'),
178 'where' => 'civicrm_membership_log.start_date',
179 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
180 'table_name' => 'civicrm_membership_log',
181 'entity' => 'MembershipLog',
182 'bao' => 'CRM_Member_BAO_MembershipLog',
187 'name' => 'end_date',
188 'type' => CRM_Utils_Type
::T_DATE
,
189 'title' => ts('Membership Log End Date'),
190 'description' => ts('New membership period expiration date.'),
191 'where' => 'civicrm_membership_log.end_date',
192 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
193 'table_name' => 'civicrm_membership_log',
194 'entity' => 'MembershipLog',
195 'bao' => 'CRM_Member_BAO_MembershipLog',
200 'name' => 'modified_id',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Membership Log modified By'),
203 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
204 'where' => 'civicrm_membership_log.modified_id',
205 'table_name' => 'civicrm_membership_log',
206 'entity' => 'MembershipLog',
207 'bao' => 'CRM_Member_BAO_MembershipLog',
209 'FKClassName' => 'CRM_Contact_DAO_Contact',
213 'name' => 'modified_date',
214 'type' => CRM_Utils_Type
::T_DATE
,
215 'title' => ts('Membership Change Date'),
216 'description' => ts('Date this membership modification action was logged.'),
217 'where' => 'civicrm_membership_log.modified_date',
218 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
219 'table_name' => 'civicrm_membership_log',
220 'entity' => 'MembershipLog',
221 'bao' => 'CRM_Member_BAO_MembershipLog',
225 'membership_type_id' => [
226 'name' => 'membership_type_id',
227 'type' => CRM_Utils_Type
::T_INT
,
228 'title' => ts('Membership Type ID'),
229 'description' => ts('FK to Membership Type.'),
230 'where' => 'civicrm_membership_log.membership_type_id',
231 'table_name' => 'civicrm_membership_log',
232 'entity' => 'MembershipLog',
233 'bao' => 'CRM_Member_BAO_MembershipLog',
235 'FKClassName' => 'CRM_Member_DAO_MembershipType',
239 'name' => 'max_related',
240 'type' => CRM_Utils_Type
::T_INT
,
241 'title' => ts('Maximum Related Memberships'),
242 'description' => ts('Maximum number of related memberships.'),
243 'where' => 'civicrm_membership_log.max_related',
244 'table_name' => 'civicrm_membership_log',
245 'entity' => 'MembershipLog',
246 'bao' => 'CRM_Member_BAO_MembershipLog',
251 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
253 return Civi
::$statics[__CLASS__
]['fields'];
257 * Return a mapping from field-name to the corresponding key (as used in fields()).
260 * Array(string $name => string $uniqueName).
262 public static function &fieldKeys() {
263 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
264 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
266 return Civi
::$statics[__CLASS__
]['fieldKeys'];
270 * Returns the names of this table
274 public static function getTableName() {
275 return self
::$_tableName;
279 * Returns if this table needs to be logged
283 public function getLog() {
288 * Returns the list of fields that can be imported
290 * @param bool $prefix
294 public static function &import($prefix = FALSE) {
295 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_log', $prefix, []);
300 * Returns the list of fields that can be exported
302 * @param bool $prefix
306 public static function &export($prefix = FALSE) {
307 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_log', $prefix, []);
312 * Returns the list of indices
314 * @param bool $localize
318 public static function indices($localize = TRUE) {
320 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;