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:51fef54a2bde11340084707688a511bf)
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',
155 'name' => 'membership_id',
156 'type' => CRM_Utils_Type
::T_INT
,
157 'title' => ts('Membership ID'),
158 'description' => ts('FK to Membership table'),
160 'where' => 'civicrm_membership_log.membership_id',
161 'table_name' => 'civicrm_membership_log',
162 'entity' => 'MembershipLog',
163 'bao' => 'CRM_Member_BAO_MembershipLog',
165 'FKClassName' => 'CRM_Member_DAO_Membership',
167 'label' => ts("Membership"),
172 'name' => 'status_id',
173 'type' => CRM_Utils_Type
::T_INT
,
174 'title' => ts('Membership Status ID'),
175 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
177 'where' => 'civicrm_membership_log.status_id',
178 'table_name' => 'civicrm_membership_log',
179 'entity' => 'MembershipLog',
180 'bao' => 'CRM_Member_BAO_MembershipLog',
182 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
184 'label' => ts("Membership Status"),
189 'name' => 'start_date',
190 'type' => CRM_Utils_Type
::T_DATE
,
191 'title' => ts('Membership Log Start Date'),
192 'description' => ts('New membership period start date'),
193 'where' => 'civicrm_membership_log.start_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' => 'end_date',
203 'type' => CRM_Utils_Type
::T_DATE
,
204 'title' => ts('Membership Log End Date'),
205 'description' => ts('New membership period expiration date.'),
206 'where' => 'civicrm_membership_log.end_date',
207 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
208 'table_name' => 'civicrm_membership_log',
209 'entity' => 'MembershipLog',
210 'bao' => 'CRM_Member_BAO_MembershipLog',
215 'name' => 'modified_id',
216 'type' => CRM_Utils_Type
::T_INT
,
217 'title' => ts('Modified By Contact ID'),
218 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
219 'where' => 'civicrm_membership_log.modified_id',
220 'table_name' => 'civicrm_membership_log',
221 'entity' => 'MembershipLog',
222 'bao' => 'CRM_Member_BAO_MembershipLog',
224 'FKClassName' => 'CRM_Contact_DAO_Contact',
226 'label' => ts("Modified By"),
231 'name' => 'modified_date',
232 'type' => CRM_Utils_Type
::T_DATE
,
233 'title' => ts('Membership Change Date'),
234 'description' => ts('Date this membership modification action was logged.'),
235 'where' => 'civicrm_membership_log.modified_date',
236 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
237 'table_name' => 'civicrm_membership_log',
238 'entity' => 'MembershipLog',
239 'bao' => 'CRM_Member_BAO_MembershipLog',
243 'membership_type_id' => [
244 'name' => 'membership_type_id',
245 'type' => CRM_Utils_Type
::T_INT
,
246 'title' => ts('Membership Type ID'),
247 'description' => ts('FK to Membership Type.'),
248 'where' => 'civicrm_membership_log.membership_type_id',
249 'table_name' => 'civicrm_membership_log',
250 'entity' => 'MembershipLog',
251 'bao' => 'CRM_Member_BAO_MembershipLog',
253 'FKClassName' => 'CRM_Member_DAO_MembershipType',
255 'label' => ts("Membership Type"),
260 'name' => 'max_related',
261 'type' => CRM_Utils_Type
::T_INT
,
262 'title' => ts('Maximum Related Memberships'),
263 'description' => ts('Maximum number of related memberships.'),
264 'where' => 'civicrm_membership_log.max_related',
265 'table_name' => 'civicrm_membership_log',
266 'entity' => 'MembershipLog',
267 'bao' => 'CRM_Member_BAO_MembershipLog',
272 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
274 return Civi
::$statics[__CLASS__
]['fields'];
278 * Return a mapping from field-name to the corresponding key (as used in fields()).
281 * Array(string $name => string $uniqueName).
283 public static function &fieldKeys() {
284 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
285 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
287 return Civi
::$statics[__CLASS__
]['fieldKeys'];
291 * Returns the names of this table
295 public static function getTableName() {
296 return self
::$_tableName;
300 * Returns if this table needs to be logged
304 public function getLog() {
309 * Returns the list of fields that can be imported
311 * @param bool $prefix
315 public static function &import($prefix = FALSE) {
316 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_log', $prefix, []);
321 * Returns the list of fields that can be exported
323 * @param bool $prefix
327 public static function &export($prefix = FALSE) {
328 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_log', $prefix, []);
333 * Returns the list of indices
335 * @param bool $localize
339 public static function indices($localize = TRUE) {
341 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;