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:d1e55c6d7f0e93b21778fdd36dd6e022)
13 * Database access object for the MembershipLog entity.
15 class CRM_Member_DAO_MembershipLog
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.5';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_membership_log';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
39 * FK to Membership table
43 public $membership_id;
46 * New status assigned to membership by this action. FK to Membership Status
53 * New membership period start date
60 * New membership period expiration date.
67 * FK to Contact ID of person under whose credentials this data modification was made.
74 * Date this membership modification action was logged.
78 public $modified_date;
81 * FK to Membership Type.
85 public $membership_type_id;
88 * Maximum number of related memberships.
97 public function __construct() {
98 $this->__table
= 'civicrm_membership_log';
99 parent
::__construct();
103 * Returns localized title of this entity.
105 * @param bool $plural
106 * Whether to return the plural version of the title.
108 public static function getEntityTitle($plural = FALSE) {
109 return $plural ?
ts('Membership Logs') : ts('Membership Log');
113 * Returns foreign keys and entity references.
116 * [CRM_Core_Reference_Interface]
118 public static function getReferenceColumns() {
119 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
120 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
125 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
127 return Civi
::$statics[__CLASS__
]['links'];
131 * Returns all the column names of this table
135 public static function &fields() {
136 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
137 Civi
::$statics[__CLASS__
]['fields'] = [
140 'type' => CRM_Utils_Type
::T_INT
,
141 'title' => ts('Membership Log ID'),
143 'where' => 'civicrm_membership_log.id',
144 'table_name' => 'civicrm_membership_log',
145 'entity' => 'MembershipLog',
146 'bao' => 'CRM_Member_BAO_MembershipLog',
151 'name' => 'membership_id',
152 'type' => CRM_Utils_Type
::T_INT
,
153 'title' => ts('Membership ID'),
154 'description' => ts('FK to Membership table'),
156 'where' => 'civicrm_membership_log.membership_id',
157 'table_name' => 'civicrm_membership_log',
158 'entity' => 'MembershipLog',
159 'bao' => 'CRM_Member_BAO_MembershipLog',
161 'FKClassName' => 'CRM_Member_DAO_Membership',
165 'name' => 'status_id',
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Membership Status'),
168 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
170 'where' => 'civicrm_membership_log.status_id',
171 'table_name' => 'civicrm_membership_log',
172 'entity' => 'MembershipLog',
173 'bao' => 'CRM_Member_BAO_MembershipLog',
175 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
179 'name' => 'start_date',
180 'type' => CRM_Utils_Type
::T_DATE
,
181 'title' => ts('Membership Log Start Date'),
182 'description' => ts('New membership period start date'),
183 'where' => 'civicrm_membership_log.start_date',
184 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
185 'table_name' => 'civicrm_membership_log',
186 'entity' => 'MembershipLog',
187 'bao' => 'CRM_Member_BAO_MembershipLog',
192 'name' => 'end_date',
193 'type' => CRM_Utils_Type
::T_DATE
,
194 'title' => ts('Membership Log End Date'),
195 'description' => ts('New membership period expiration date.'),
196 'where' => 'civicrm_membership_log.end_date',
197 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
198 'table_name' => 'civicrm_membership_log',
199 'entity' => 'MembershipLog',
200 'bao' => 'CRM_Member_BAO_MembershipLog',
205 'name' => 'modified_id',
206 'type' => CRM_Utils_Type
::T_INT
,
207 'title' => ts('Membership Log modified By'),
208 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
209 'where' => 'civicrm_membership_log.modified_id',
210 'table_name' => 'civicrm_membership_log',
211 'entity' => 'MembershipLog',
212 'bao' => 'CRM_Member_BAO_MembershipLog',
214 'FKClassName' => 'CRM_Contact_DAO_Contact',
218 'name' => 'modified_date',
219 'type' => CRM_Utils_Type
::T_DATE
,
220 'title' => ts('Membership Change Date'),
221 'description' => ts('Date this membership modification action was logged.'),
222 'where' => 'civicrm_membership_log.modified_date',
223 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
224 'table_name' => 'civicrm_membership_log',
225 'entity' => 'MembershipLog',
226 'bao' => 'CRM_Member_BAO_MembershipLog',
230 'membership_type_id' => [
231 'name' => 'membership_type_id',
232 'type' => CRM_Utils_Type
::T_INT
,
233 'title' => ts('Membership Type ID'),
234 'description' => ts('FK to Membership Type.'),
235 'where' => 'civicrm_membership_log.membership_type_id',
236 'table_name' => 'civicrm_membership_log',
237 'entity' => 'MembershipLog',
238 'bao' => 'CRM_Member_BAO_MembershipLog',
240 'FKClassName' => 'CRM_Member_DAO_MembershipType',
244 'name' => 'max_related',
245 'type' => CRM_Utils_Type
::T_INT
,
246 'title' => ts('Maximum Related Memberships'),
247 'description' => ts('Maximum number of related memberships.'),
248 'where' => 'civicrm_membership_log.max_related',
249 'table_name' => 'civicrm_membership_log',
250 'entity' => 'MembershipLog',
251 'bao' => 'CRM_Member_BAO_MembershipLog',
256 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
258 return Civi
::$statics[__CLASS__
]['fields'];
262 * Return a mapping from field-name to the corresponding key (as used in fields()).
265 * Array(string $name => string $uniqueName).
267 public static function &fieldKeys() {
268 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
269 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
271 return Civi
::$statics[__CLASS__
]['fieldKeys'];
275 * Returns the names of this table
279 public static function getTableName() {
280 return self
::$_tableName;
284 * Returns if this table needs to be logged
288 public function getLog() {
293 * Returns the list of fields that can be imported
295 * @param bool $prefix
299 public static function &import($prefix = FALSE) {
300 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_log', $prefix, []);
305 * Returns the list of fields that can be exported
307 * @param bool $prefix
311 public static function &export($prefix = FALSE) {
312 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_log', $prefix, []);
317 * Returns the list of indices
319 * @param bool $localize
323 public static function indices($localize = TRUE) {
325 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;