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:cca53e3abe058a7b585138271658d90c)
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',
156 'name' => 'membership_id',
157 'type' => CRM_Utils_Type
::T_INT
,
158 'title' => ts('Membership ID'),
159 'description' => ts('FK to Membership table'),
161 'where' => 'civicrm_membership_log.membership_id',
162 'table_name' => 'civicrm_membership_log',
163 'entity' => 'MembershipLog',
164 'bao' => 'CRM_Member_BAO_MembershipLog',
166 'FKClassName' => 'CRM_Member_DAO_Membership',
168 'label' => ts("Membership"),
173 'name' => 'status_id',
174 'type' => CRM_Utils_Type
::T_INT
,
175 'title' => ts('Membership Status ID'),
176 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
178 'where' => 'civicrm_membership_log.status_id',
179 'table_name' => 'civicrm_membership_log',
180 'entity' => 'MembershipLog',
181 'bao' => 'CRM_Member_BAO_MembershipLog',
183 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
185 'label' => ts("Membership Status"),
190 'name' => 'start_date',
191 'type' => CRM_Utils_Type
::T_DATE
,
192 'title' => ts('Membership Log Start Date'),
193 'description' => ts('New membership period start date'),
194 'where' => 'civicrm_membership_log.start_date',
195 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
196 'table_name' => 'civicrm_membership_log',
197 'entity' => 'MembershipLog',
198 'bao' => 'CRM_Member_BAO_MembershipLog',
203 'name' => 'end_date',
204 'type' => CRM_Utils_Type
::T_DATE
,
205 'title' => ts('Membership Log End Date'),
206 'description' => ts('New membership period expiration date.'),
207 'where' => 'civicrm_membership_log.end_date',
208 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
209 'table_name' => 'civicrm_membership_log',
210 'entity' => 'MembershipLog',
211 'bao' => 'CRM_Member_BAO_MembershipLog',
216 'name' => 'modified_id',
217 'type' => CRM_Utils_Type
::T_INT
,
218 'title' => ts('Modified By Contact ID'),
219 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
220 'where' => 'civicrm_membership_log.modified_id',
221 'table_name' => 'civicrm_membership_log',
222 'entity' => 'MembershipLog',
223 'bao' => 'CRM_Member_BAO_MembershipLog',
225 'FKClassName' => 'CRM_Contact_DAO_Contact',
227 'label' => ts("Modified By"),
233 'name' => 'modified_date',
234 'type' => CRM_Utils_Type
::T_DATE
,
235 'title' => ts('Membership Change Date'),
236 'description' => ts('Date this membership modification action was logged.'),
237 'where' => 'civicrm_membership_log.modified_date',
238 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
239 'table_name' => 'civicrm_membership_log',
240 'entity' => 'MembershipLog',
241 'bao' => 'CRM_Member_BAO_MembershipLog',
245 'membership_type_id' => [
246 'name' => 'membership_type_id',
247 'type' => CRM_Utils_Type
::T_INT
,
248 'title' => ts('Membership Type ID'),
249 'description' => ts('FK to Membership Type.'),
250 'where' => 'civicrm_membership_log.membership_type_id',
251 'table_name' => 'civicrm_membership_log',
252 'entity' => 'MembershipLog',
253 'bao' => 'CRM_Member_BAO_MembershipLog',
255 'FKClassName' => 'CRM_Member_DAO_MembershipType',
257 'label' => ts("Membership Type"),
262 'name' => 'max_related',
263 'type' => CRM_Utils_Type
::T_INT
,
264 'title' => ts('Maximum Related Memberships'),
265 'description' => ts('Maximum number of related memberships.'),
266 'where' => 'civicrm_membership_log.max_related',
267 'table_name' => 'civicrm_membership_log',
268 'entity' => 'MembershipLog',
269 'bao' => 'CRM_Member_BAO_MembershipLog',
274 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
276 return Civi
::$statics[__CLASS__
]['fields'];
280 * Return a mapping from field-name to the corresponding key (as used in fields()).
283 * Array(string $name => string $uniqueName).
285 public static function &fieldKeys() {
286 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
287 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
289 return Civi
::$statics[__CLASS__
]['fieldKeys'];
293 * Returns the names of this table
297 public static function getTableName() {
298 return self
::$_tableName;
302 * Returns if this table needs to be logged
306 public function getLog() {
311 * Returns the list of fields that can be imported
313 * @param bool $prefix
317 public static function &import($prefix = FALSE) {
318 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_log', $prefix, []);
323 * Returns the list of fields that can be exported
325 * @param bool $prefix
329 public static function &export($prefix = FALSE) {
330 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_log', $prefix, []);
335 * Returns the list of indices
337 * @param bool $localize
341 public static function indices($localize = TRUE) {
343 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;