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:0064664a5741cb1f9ba8fea392dcef22)
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;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
42 * FK to Membership table
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
48 public $membership_id;
51 * New status assigned to membership by this action. FK to Membership Status
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
60 * New membership period start date
64 * Note that values will be retrieved from the database as a string.
69 * New membership period expiration date.
73 * Note that values will be retrieved from the database as a string.
78 * FK to Contact ID of person under whose credentials this data modification was made.
80 * @var int|string|null
81 * (SQL type: int unsigned)
82 * Note that values will be retrieved from the database as a string.
87 * Date this membership modification action was logged.
91 * Note that values will be retrieved from the database as a string.
93 public $modified_date;
96 * FK to Membership Type.
98 * @var int|string|null
99 * (SQL type: int unsigned)
100 * Note that values will be retrieved from the database as a string.
102 public $membership_type_id;
105 * Maximum number of related memberships.
107 * @var int|string|null
109 * Note that values will be retrieved from the database as a string.
116 public function __construct() {
117 $this->__table
= 'civicrm_membership_log';
118 parent
::__construct();
122 * Returns localized title of this entity.
124 * @param bool $plural
125 * Whether to return the plural version of the title.
127 public static function getEntityTitle($plural = FALSE) {
128 return $plural ?
ts('Membership Logs') : ts('Membership Log');
132 * Returns foreign keys and entity references.
135 * [CRM_Core_Reference_Interface]
137 public static function getReferenceColumns() {
138 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
139 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
140 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_id', 'civicrm_membership', 'id');
141 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'status_id', 'civicrm_membership_status', 'id');
142 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
143 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'membership_type_id', 'civicrm_membership_type', 'id');
144 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
146 return Civi
::$statics[__CLASS__
]['links'];
150 * Returns all the column names of this table
154 public static function &fields() {
155 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
156 Civi
::$statics[__CLASS__
]['fields'] = [
159 'type' => CRM_Utils_Type
::T_INT
,
160 'title' => ts('Membership Log ID'),
162 'where' => 'civicrm_membership_log.id',
163 'table_name' => 'civicrm_membership_log',
164 'entity' => 'MembershipLog',
165 'bao' => 'CRM_Member_BAO_MembershipLog',
174 'name' => 'membership_id',
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Membership ID'),
177 'description' => ts('FK to Membership table'),
179 'where' => 'civicrm_membership_log.membership_id',
180 'table_name' => 'civicrm_membership_log',
181 'entity' => 'MembershipLog',
182 'bao' => 'CRM_Member_BAO_MembershipLog',
184 'FKClassName' => 'CRM_Member_DAO_Membership',
186 'label' => ts("Membership"),
191 'name' => 'status_id',
192 'type' => CRM_Utils_Type
::T_INT
,
193 'title' => ts('Membership Status ID'),
194 'description' => ts('New status assigned to membership by this action. FK to Membership Status'),
196 'where' => 'civicrm_membership_log.status_id',
197 'table_name' => 'civicrm_membership_log',
198 'entity' => 'MembershipLog',
199 'bao' => 'CRM_Member_BAO_MembershipLog',
201 'FKClassName' => 'CRM_Member_DAO_MembershipStatus',
203 'label' => ts("Membership Status"),
208 'name' => 'start_date',
209 'type' => CRM_Utils_Type
::T_DATE
,
210 'title' => ts('Membership Log Start Date'),
211 'description' => ts('New membership period start date'),
212 'where' => 'civicrm_membership_log.start_date',
213 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
214 'table_name' => 'civicrm_membership_log',
215 'entity' => 'MembershipLog',
216 'bao' => 'CRM_Member_BAO_MembershipLog',
221 'name' => 'end_date',
222 'type' => CRM_Utils_Type
::T_DATE
,
223 'title' => ts('Membership Log End Date'),
224 'description' => ts('New membership period expiration date.'),
225 'where' => 'civicrm_membership_log.end_date',
226 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
227 'table_name' => 'civicrm_membership_log',
228 'entity' => 'MembershipLog',
229 'bao' => 'CRM_Member_BAO_MembershipLog',
234 'name' => 'modified_id',
235 'type' => CRM_Utils_Type
::T_INT
,
236 'title' => ts('Modified By Contact ID'),
237 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
238 'where' => 'civicrm_membership_log.modified_id',
239 'table_name' => 'civicrm_membership_log',
240 'entity' => 'MembershipLog',
241 'bao' => 'CRM_Member_BAO_MembershipLog',
243 'FKClassName' => 'CRM_Contact_DAO_Contact',
245 'label' => ts("Modified By"),
251 'name' => 'modified_date',
252 'type' => CRM_Utils_Type
::T_DATE
,
253 'title' => ts('Membership Change Date'),
254 'description' => ts('Date this membership modification action was logged.'),
255 'where' => 'civicrm_membership_log.modified_date',
256 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/',
257 'table_name' => 'civicrm_membership_log',
258 'entity' => 'MembershipLog',
259 'bao' => 'CRM_Member_BAO_MembershipLog',
263 'membership_type_id' => [
264 'name' => 'membership_type_id',
265 'type' => CRM_Utils_Type
::T_INT
,
266 'title' => ts('Membership Type ID'),
267 'description' => ts('FK to Membership Type.'),
268 'where' => 'civicrm_membership_log.membership_type_id',
269 'table_name' => 'civicrm_membership_log',
270 'entity' => 'MembershipLog',
271 'bao' => 'CRM_Member_BAO_MembershipLog',
273 'FKClassName' => 'CRM_Member_DAO_MembershipType',
275 'label' => ts("Membership Type"),
280 'name' => 'max_related',
281 'type' => CRM_Utils_Type
::T_INT
,
282 'title' => ts('Maximum Related Memberships'),
283 'description' => ts('Maximum number of related memberships.'),
284 'where' => 'civicrm_membership_log.max_related',
285 'table_name' => 'civicrm_membership_log',
286 'entity' => 'MembershipLog',
287 'bao' => 'CRM_Member_BAO_MembershipLog',
292 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
294 return Civi
::$statics[__CLASS__
]['fields'];
298 * Return a mapping from field-name to the corresponding key (as used in fields()).
301 * Array(string $name => string $uniqueName).
303 public static function &fieldKeys() {
304 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
305 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
307 return Civi
::$statics[__CLASS__
]['fieldKeys'];
311 * Returns the names of this table
315 public static function getTableName() {
316 return self
::$_tableName;
320 * Returns if this table needs to be logged
324 public function getLog() {
329 * Returns the list of fields that can be imported
331 * @param bool $prefix
335 public static function &import($prefix = FALSE) {
336 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'membership_log', $prefix, []);
341 * Returns the list of fields that can be exported
343 * @param bool $prefix
347 public static function &export($prefix = FALSE) {
348 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'membership_log', $prefix, []);
353 * Returns the list of indices
355 * @param bool $localize
359 public static function indices($localize = TRUE) {
361 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;