5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Contact/SubscriptionHistory.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:8b7f0a4e3593bc26947b4bb6cf54c2d2)
13 * Database access object for the SubscriptionHistory entity.
15 class CRM_Contact_DAO_SubscriptionHistory
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 static $_tableName = 'civicrm_subscription_history';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
53 * Date of the (un)subscription
60 * How the (un)subscription was triggered
67 * The state of the contact within the group
74 * IP address or other tracking info
83 public function __construct() {
84 $this->__table
= 'civicrm_subscription_history';
85 parent
::__construct();
89 * Returns foreign keys and entity references.
92 * [CRM_Core_Reference_Interface]
94 public static function getReferenceColumns() {
95 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
96 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
98 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'group_id', 'civicrm_group', 'id');
99 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
101 return Civi
::$statics[__CLASS__
]['links'];
105 * Returns all the column names of this table
109 public static function &fields() {
110 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
111 Civi
::$statics[__CLASS__
]['fields'] = [
114 'type' => CRM_Utils_Type
::T_INT
,
115 'title' => ts('Group Membership History ID'),
116 'description' => 'Internal Id',
118 'table_name' => 'civicrm_subscription_history',
119 'entity' => 'SubscriptionHistory',
120 'bao' => 'CRM_Contact_BAO_SubscriptionHistory',
124 'name' => 'contact_id',
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('Contact ID'),
127 'description' => 'Contact Id',
129 'table_name' => 'civicrm_subscription_history',
130 'entity' => 'SubscriptionHistory',
131 'bao' => 'CRM_Contact_BAO_SubscriptionHistory',
133 'FKClassName' => 'CRM_Contact_DAO_Contact',
136 'name' => 'group_id',
137 'type' => CRM_Utils_Type
::T_INT
,
138 'title' => ts('Group'),
139 'description' => 'Group Id',
140 'table_name' => 'civicrm_subscription_history',
141 'entity' => 'SubscriptionHistory',
142 'bao' => 'CRM_Contact_BAO_SubscriptionHistory',
144 'FKClassName' => 'CRM_Contact_DAO_Group',
148 'pseudoconstant' => [
149 'table' => 'civicrm_group',
151 'labelColumn' => 'title',
156 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
157 'title' => ts('Group Membership Action Date'),
158 'description' => 'Date of the (un)subscription',
160 'default' => 'CURRENT_TIMESTAMP',
161 'table_name' => 'civicrm_subscription_history',
162 'entity' => 'SubscriptionHistory',
163 'bao' => 'CRM_Contact_BAO_SubscriptionHistory',
168 'type' => CRM_Utils_Type
::T_STRING
,
169 'title' => ts('Group Membership Action'),
170 'description' => 'How the (un)subscription was triggered',
172 'size' => CRM_Utils_Type
::EIGHT
,
173 'table_name' => 'civicrm_subscription_history',
174 'entity' => 'SubscriptionHistory',
175 'bao' => 'CRM_Contact_BAO_SubscriptionHistory',
180 'pseudoconstant' => [
181 'callback' => 'CRM_Core_SelectValues::getSubscriptionHistoryMethods',
186 'type' => CRM_Utils_Type
::T_STRING
,
187 'title' => ts('Group Membership Status'),
188 'description' => 'The state of the contact within the group',
190 'size' => CRM_Utils_Type
::EIGHT
,
191 'table_name' => 'civicrm_subscription_history',
192 'entity' => 'SubscriptionHistory',
193 'bao' => 'CRM_Contact_BAO_SubscriptionHistory',
195 'pseudoconstant' => [
196 'callback' => 'CRM_Core_SelectValues::groupContactStatus',
200 'name' => 'tracking',
201 'type' => CRM_Utils_Type
::T_STRING
,
202 'title' => ts('Group Membership Tracking'),
203 'description' => 'IP address or other tracking info',
205 'size' => CRM_Utils_Type
::HUGE
,
206 'table_name' => 'civicrm_subscription_history',
207 'entity' => 'SubscriptionHistory',
208 'bao' => 'CRM_Contact_BAO_SubscriptionHistory',
212 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
214 return Civi
::$statics[__CLASS__
]['fields'];
218 * Return a mapping from field-name to the corresponding key (as used in fields()).
221 * Array(string $name => string $uniqueName).
223 public static function &fieldKeys() {
224 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
225 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
227 return Civi
::$statics[__CLASS__
]['fieldKeys'];
231 * Returns the names of this table
235 public static function getTableName() {
236 return self
::$_tableName;
240 * Returns if this table needs to be logged
244 public function getLog() {
249 * Returns the list of fields that can be imported
251 * @param bool $prefix
255 public static function &import($prefix = FALSE) {
256 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'subscription_history', $prefix, []);
261 * Returns the list of fields that can be exported
263 * @param bool $prefix
267 public static function &export($prefix = FALSE) {
268 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'subscription_history', $prefix, []);
273 * Returns the list of indices
275 * @param bool $localize
279 public static function indices($localize = TRUE) {
281 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;