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:4d5744b433ca7bb5385b11945cc0fe10)
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 public static function getEntityTitle() {
106 return ts('Membership Logs');
110 * Returns foreign keys and entity references.
113 * [CRM_Core_Reference_Interface]
115 public static function getReferenceColumns() {
116 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
117 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
118 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_id', 'civicrm_membership', 'id');
119 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'status_id', 'civicrm_membership_status', 'id');
120 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
121 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id');
122 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
124 return Civi
::$statics[__CLASS__
]['links'];
128 * Returns all the column names of this table
132 public static function &fields() {
133 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
134 Civi
::$statics[__CLASS__
]['fields'] = [
137 'type' => CRM_Utils_Type
::T_INT
,
138 'title' => ts('Membership Log ID'),
140 'where' => 'civicrm_membership_log.id',
141 'table_name' => 'civicrm_membership_log',
142 'entity' => 'MembershipLog',
143 'bao' => 'CRM_Member_BAO_MembershipLog',
148 'name' => 'membership_id',
149 'type' => CRM_Utils_Type
::T_INT
,
150 'title' => ts('Membership ID'),
151 'description' => ts('FK to Membership table'),
153 'where' => 'civicrm_membership_log.membership_id',
154 'table_name' => 'civicrm_membership_log',
155 'entity' => 'MembershipLog',
156 'bao' => 'CRM_Member_BAO_MembershipLog',
158 'FKClassName' => 'CRM_Member_DAO_Membership',
162 'name' => 'status_id',
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Membership Status'),
165 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
167 'where' => 'civicrm_membership_log.status_id',
168 'table_name' => 'civicrm_membership_log',
169 'entity' => 'MembershipLog',
170 'bao' => 'CRM_Member_BAO_MembershipLog',
172 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
176 'name' => 'start_date',
177 'type' => CRM_Utils_Type
::T_DATE
,
178 'title' => ts('Membership Log Start Date'),
179 'description' => ts('New membership period start date'),
180 'where' => 'civicrm_membership_log.start_date',
181 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
182 'table_name' => 'civicrm_membership_log',
183 'entity' => 'MembershipLog',
184 'bao' => 'CRM_Member_BAO_MembershipLog',
189 'name' => 'end_date',
190 'type' => CRM_Utils_Type
::T_DATE
,
191 'title' => ts('Membership Log End Date'),
192 'description' => ts('New membership period expiration date.'),
193 'where' => 'civicrm_membership_log.end_date',
194 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
195 'table_name' => 'civicrm_membership_log',
196 'entity' => 'MembershipLog',
197 'bao' => 'CRM_Member_BAO_MembershipLog',
202 'name' => 'modified_id',
203 'type' => CRM_Utils_Type
::T_INT
,
204 'title' => ts('Membership Log modified By'),
205 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
206 'where' => 'civicrm_membership_log.modified_id',
207 'table_name' => 'civicrm_membership_log',
208 'entity' => 'MembershipLog',
209 'bao' => 'CRM_Member_BAO_MembershipLog',
211 'FKClassName' => 'CRM_Contact_DAO_Contact',
215 'name' => 'modified_date',
216 'type' => CRM_Utils_Type
::T_DATE
,
217 'title' => ts('Membership Change Date'),
218 'description' => ts('Date this membership modification action was logged.'),
219 'where' => 'civicrm_membership_log.modified_date',
220 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
221 'table_name' => 'civicrm_membership_log',
222 'entity' => 'MembershipLog',
223 'bao' => 'CRM_Member_BAO_MembershipLog',
227 'membership_type_id' => [
228 'name' => 'membership_type_id',
229 'type' => CRM_Utils_Type
::T_INT
,
230 'title' => ts('Membership Type ID'),
231 'description' => ts('FK to Membership Type.'),
232 'where' => 'civicrm_membership_log.membership_type_id',
233 'table_name' => 'civicrm_membership_log',
234 'entity' => 'MembershipLog',
235 'bao' => 'CRM_Member_BAO_MembershipLog',
237 'FKClassName' => 'CRM_Member_DAO_MembershipType',
241 'name' => 'max_related',
242 'type' => CRM_Utils_Type
::T_INT
,
243 'title' => ts('Maximum Related Memberships'),
244 'description' => ts('Maximum number of related memberships.'),
245 'where' => 'civicrm_membership_log.max_related',
246 'table_name' => 'civicrm_membership_log',
247 'entity' => 'MembershipLog',
248 'bao' => 'CRM_Member_BAO_MembershipLog',
253 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
255 return Civi
::$statics[__CLASS__
]['fields'];
259 * Return a mapping from field-name to the corresponding key (as used in fields()).
262 * Array(string $name => string $uniqueName).
264 public static function &fieldKeys() {
265 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
266 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
268 return Civi
::$statics[__CLASS__
]['fieldKeys'];
272 * Returns the names of this table
276 public static function getTableName() {
277 return self
::$_tableName;
281 * Returns if this table needs to be logged
285 public function getLog() {
290 * Returns the list of fields that can be imported
292 * @param bool $prefix
296 public static function &import($prefix = FALSE) {
297 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_log', $prefix, []);
302 * Returns the list of fields that can be exported
304 * @param bool $prefix
308 public static function &export($prefix = FALSE) {
309 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_log', $prefix, []);
314 * Returns the list of indices
316 * @param bool $localize
320 public static function indices($localize = TRUE) {
322 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;