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:7374d7db00c9fe6e86a696434b8bba6f)
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';
18 const COMPONENT
= 'CiviMember';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_membership_log';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = TRUE;
40 * FK to Membership table
44 public $membership_id;
47 * New status assigned to membership by this action. FK to Membership Status
54 * New membership period start date
61 * New membership period expiration date.
68 * FK to Contact ID of person under whose credentials this data modification was made.
75 * Date this membership modification action was logged.
79 public $modified_date;
82 * FK to Membership Type.
86 public $membership_type_id;
89 * Maximum number of related memberships.
98 public function __construct() {
99 $this->__table
= 'civicrm_membership_log';
100 parent
::__construct();
104 * Returns localized title of this entity.
106 * @param bool $plural
107 * Whether to return the plural version of the title.
109 public static function getEntityTitle($plural = FALSE) {
110 return $plural ?
ts('Membership Logs') : ts('Membership Log');
114 * Returns foreign keys and entity references.
117 * [CRM_Core_Reference_Interface]
119 public 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']);
128 return Civi
::$statics[__CLASS__
]['links'];
132 * Returns all the column names of this table
136 public static function &fields() {
137 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
138 Civi
::$statics[__CLASS__
]['fields'] = [
141 'type' => CRM_Utils_Type
::T_INT
,
142 'title' => ts('Membership Log ID'),
144 'where' => 'civicrm_membership_log.id',
145 'table_name' => 'civicrm_membership_log',
146 'entity' => 'MembershipLog',
147 'bao' => 'CRM_Member_BAO_MembershipLog',
152 'name' => 'membership_id',
153 'type' => CRM_Utils_Type
::T_INT
,
154 'title' => ts('Membership ID'),
155 'description' => ts('FK to Membership table'),
157 'where' => 'civicrm_membership_log.membership_id',
158 'table_name' => 'civicrm_membership_log',
159 'entity' => 'MembershipLog',
160 'bao' => 'CRM_Member_BAO_MembershipLog',
162 'FKClassName' => 'CRM_Member_DAO_Membership',
166 'name' => 'status_id',
167 'type' => CRM_Utils_Type
::T_INT
,
168 'title' => ts('Membership Status'),
169 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
171 'where' => 'civicrm_membership_log.status_id',
172 'table_name' => 'civicrm_membership_log',
173 'entity' => 'MembershipLog',
174 'bao' => 'CRM_Member_BAO_MembershipLog',
176 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
180 'name' => 'start_date',
181 'type' => CRM_Utils_Type
::T_DATE
,
182 'title' => ts('Membership Log Start Date'),
183 'description' => ts('New membership period start date'),
184 'where' => 'civicrm_membership_log.start_date',
185 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
186 'table_name' => 'civicrm_membership_log',
187 'entity' => 'MembershipLog',
188 'bao' => 'CRM_Member_BAO_MembershipLog',
193 'name' => 'end_date',
194 'type' => CRM_Utils_Type
::T_DATE
,
195 'title' => ts('Membership Log End Date'),
196 'description' => ts('New membership period expiration date.'),
197 'where' => 'civicrm_membership_log.end_date',
198 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
199 'table_name' => 'civicrm_membership_log',
200 'entity' => 'MembershipLog',
201 'bao' => 'CRM_Member_BAO_MembershipLog',
206 'name' => 'modified_id',
207 'type' => CRM_Utils_Type
::T_INT
,
208 'title' => ts('Membership Log modified By'),
209 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
210 'where' => 'civicrm_membership_log.modified_id',
211 'table_name' => 'civicrm_membership_log',
212 'entity' => 'MembershipLog',
213 'bao' => 'CRM_Member_BAO_MembershipLog',
215 'FKClassName' => 'CRM_Contact_DAO_Contact',
219 'name' => 'modified_date',
220 'type' => CRM_Utils_Type
::T_DATE
,
221 'title' => ts('Membership Change Date'),
222 'description' => ts('Date this membership modification action was logged.'),
223 'where' => 'civicrm_membership_log.modified_date',
224 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
225 'table_name' => 'civicrm_membership_log',
226 'entity' => 'MembershipLog',
227 'bao' => 'CRM_Member_BAO_MembershipLog',
231 'membership_type_id' => [
232 'name' => 'membership_type_id',
233 'type' => CRM_Utils_Type
::T_INT
,
234 'title' => ts('Membership Type ID'),
235 'description' => ts('FK to Membership Type.'),
236 'where' => 'civicrm_membership_log.membership_type_id',
237 'table_name' => 'civicrm_membership_log',
238 'entity' => 'MembershipLog',
239 'bao' => 'CRM_Member_BAO_MembershipLog',
241 'FKClassName' => 'CRM_Member_DAO_MembershipType',
245 'name' => 'max_related',
246 'type' => CRM_Utils_Type
::T_INT
,
247 'title' => ts('Maximum Related Memberships'),
248 'description' => ts('Maximum number of related memberships.'),
249 'where' => 'civicrm_membership_log.max_related',
250 'table_name' => 'civicrm_membership_log',
251 'entity' => 'MembershipLog',
252 'bao' => 'CRM_Member_BAO_MembershipLog',
257 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
259 return Civi
::$statics[__CLASS__
]['fields'];
263 * Return a mapping from field-name to the corresponding key (as used in fields()).
266 * Array(string $name => string $uniqueName).
268 public static function &fieldKeys() {
269 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
270 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
272 return Civi
::$statics[__CLASS__
]['fieldKeys'];
276 * Returns the names of this table
280 public static function getTableName() {
281 return self
::$_tableName;
285 * Returns if this table needs to be logged
289 public function getLog() {
294 * Returns the list of fields that can be imported
296 * @param bool $prefix
300 public static function &import($prefix = FALSE) {
301 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_log', $prefix, []);
306 * Returns the list of fields that can be exported
308 * @param bool $prefix
312 public static function &export($prefix = FALSE) {
313 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_log', $prefix, []);
318 * Returns the list of indices
320 * @param bool $localize
324 public static function indices($localize = TRUE) {
326 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;