Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Contact/SubscriptionHistory.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
88c31c05 | 9 | * (GenCodeChecksum:58a499585518faad19d52d57dfb1f1ba) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the SubscriptionHistory entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Contact_DAO_SubscriptionHistory extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.1'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_subscription_history'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = TRUE; |
c3fc2621 | 32 | |
e501603b | 33 | /** |
2cbbebe8 | 34 | * Internal ID |
e501603b | 35 | * |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b | 40 | /** |
2cbbebe8 | 41 | * Contact ID |
e501603b | 42 | * |
e6ca0a57 | 43 | * @var int |
e501603b TO |
44 | */ |
45 | public $contact_id; | |
c3fc2621 | 46 | |
e501603b | 47 | /** |
2cbbebe8 | 48 | * Group ID |
e501603b | 49 | * |
e6ca0a57 | 50 | * @var int |
e501603b TO |
51 | */ |
52 | public $group_id; | |
c3fc2621 | 53 | |
e501603b TO |
54 | /** |
55 | * Date of the (un)subscription | |
56 | * | |
5a393bfc | 57 | * @var timestamp |
e501603b TO |
58 | */ |
59 | public $date; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * How the (un)subscription was triggered | |
63 | * | |
64 | * @var string | |
65 | */ | |
66 | public $method; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * The state of the contact within the group | |
70 | * | |
71 | * @var string | |
72 | */ | |
73 | public $status; | |
c3fc2621 | 74 | |
e501603b TO |
75 | /** |
76 | * IP address or other tracking info | |
77 | * | |
78 | * @var string | |
79 | */ | |
80 | public $tracking; | |
c3fc2621 | 81 | |
e501603b | 82 | /** |
f41f0342 | 83 | * Class constructor. |
e501603b | 84 | */ |
c3fc2621 | 85 | public function __construct() { |
e501603b TO |
86 | $this->__table = 'civicrm_subscription_history'; |
87 | parent::__construct(); | |
88 | } | |
c3fc2621 | 89 | |
449c4e6b CW |
90 | /** |
91 | * Returns localized title of this entity. | |
7b66c3b5 AH |
92 | * |
93 | * @param bool $plural | |
94 | * Whether to return the plural version of the title. | |
449c4e6b | 95 | */ |
7b66c3b5 AH |
96 | public static function getEntityTitle($plural = FALSE) { |
97 | return $plural ? ts('Subscription Histories') : ts('Subscription History'); | |
449c4e6b CW |
98 | } |
99 | ||
e501603b | 100 | /** |
f41f0342 | 101 | * Returns foreign keys and entity references. |
e501603b TO |
102 | * |
103 | * @return array | |
104 | * [CRM_Core_Reference_Interface] | |
105 | */ | |
c3fc2621 | 106 | public static function getReferenceColumns() { |
346aaaba | 107 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 108 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
109 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
110 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); | |
346aaaba | 111 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 112 | } |
346aaaba | 113 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 114 | } |
c3fc2621 | 115 | |
e501603b TO |
116 | /** |
117 | * Returns all the column names of this table | |
118 | * | |
119 | * @return array | |
120 | */ | |
c3fc2621 | 121 | public static function &fields() { |
346aaaba | 122 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
123 | Civi::$statics[__CLASS__]['fields'] = [ |
124 | 'id' => [ | |
e501603b TO |
125 | 'name' => 'id', |
126 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 127 | 'title' => ts('Group Membership History ID'), |
2cbbebe8 | 128 | 'description' => ts('Internal ID'), |
c3fc2621 | 129 | 'required' => TRUE, |
a36434b9 | 130 | 'where' => 'civicrm_subscription_history.id', |
522a26c9 | 131 | 'table_name' => 'civicrm_subscription_history', |
132 | 'entity' => 'SubscriptionHistory', | |
133 | 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', | |
6a7e5e5d | 134 | 'localizable' => 0, |
2cbbebe8 A |
135 | 'html' => [ |
136 | 'type' => 'Number', | |
137 | ], | |
1fe423d6 | 138 | 'readonly' => TRUE, |
a9d0587b | 139 | 'add' => '1.1', |
c3fc2621 CW |
140 | ], |
141 | 'contact_id' => [ | |
e501603b TO |
142 | 'name' => 'contact_id', |
143 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 144 | 'title' => ts('Contact ID'), |
2cbbebe8 | 145 | 'description' => ts('Contact ID'), |
c3fc2621 | 146 | 'required' => TRUE, |
a36434b9 | 147 | 'where' => 'civicrm_subscription_history.contact_id', |
522a26c9 | 148 | 'table_name' => 'civicrm_subscription_history', |
149 | 'entity' => 'SubscriptionHistory', | |
150 | 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', | |
6a7e5e5d | 151 | 'localizable' => 0, |
e501603b | 152 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
153 | 'html' => [ |
154 | 'label' => ts("Contact"), | |
155 | ], | |
a9d0587b | 156 | 'add' => '1.1', |
c3fc2621 CW |
157 | ], |
158 | 'group_id' => [ | |
e501603b TO |
159 | 'name' => 'group_id', |
160 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 A |
161 | 'title' => ts('Group ID'), |
162 | 'description' => ts('Group ID'), | |
a36434b9 | 163 | 'where' => 'civicrm_subscription_history.group_id', |
522a26c9 | 164 | 'table_name' => 'civicrm_subscription_history', |
165 | 'entity' => 'SubscriptionHistory', | |
166 | 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', | |
6a7e5e5d | 167 | 'localizable' => 0, |
e501603b | 168 | 'FKClassName' => 'CRM_Contact_DAO_Group', |
c3fc2621 | 169 | 'html' => [ |
e501603b | 170 | 'type' => 'Select', |
2cbbebe8 | 171 | 'label' => ts("Group"), |
c3fc2621 CW |
172 | ], |
173 | 'pseudoconstant' => [ | |
e501603b TO |
174 | 'table' => 'civicrm_group', |
175 | 'keyColumn' => 'id', | |
176 | 'labelColumn' => 'title', | |
e6ca0a57 | 177 | ], |
a9d0587b | 178 | 'add' => '1.1', |
c3fc2621 CW |
179 | ], |
180 | 'date' => [ | |
e501603b | 181 | 'name' => 'date', |
5a393bfc | 182 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
c3fc2621 | 183 | 'title' => ts('Group Membership Action Date'), |
215b423e | 184 | 'description' => ts('Date of the (un)subscription'), |
c3fc2621 | 185 | 'required' => TRUE, |
a36434b9 | 186 | 'where' => 'civicrm_subscription_history.date', |
5a393bfc | 187 | 'default' => 'CURRENT_TIMESTAMP', |
522a26c9 | 188 | 'table_name' => 'civicrm_subscription_history', |
189 | 'entity' => 'SubscriptionHistory', | |
190 | 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', | |
6a7e5e5d | 191 | 'localizable' => 0, |
a9d0587b | 192 | 'add' => '1.1', |
c3fc2621 CW |
193 | ], |
194 | 'method' => [ | |
e501603b TO |
195 | 'name' => 'method', |
196 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 197 | 'title' => ts('Group Membership Action'), |
215b423e | 198 | 'description' => ts('How the (un)subscription was triggered'), |
e501603b TO |
199 | 'maxlength' => 8, |
200 | 'size' => CRM_Utils_Type::EIGHT, | |
a36434b9 | 201 | 'where' => 'civicrm_subscription_history.method', |
522a26c9 | 202 | 'table_name' => 'civicrm_subscription_history', |
203 | 'entity' => 'SubscriptionHistory', | |
204 | 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', | |
6a7e5e5d | 205 | 'localizable' => 0, |
c3fc2621 | 206 | 'html' => [ |
e501603b | 207 | 'type' => 'Select', |
c3fc2621 CW |
208 | ], |
209 | 'pseudoconstant' => [ | |
e501603b | 210 | 'callback' => 'CRM_Core_SelectValues::getSubscriptionHistoryMethods', |
e6ca0a57 | 211 | ], |
a9d0587b | 212 | 'add' => '1.1', |
c3fc2621 CW |
213 | ], |
214 | 'status' => [ | |
e501603b TO |
215 | 'name' => 'status', |
216 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 217 | 'title' => ts('Group Membership Status'), |
215b423e | 218 | 'description' => ts('The state of the contact within the group'), |
e501603b TO |
219 | 'maxlength' => 8, |
220 | 'size' => CRM_Utils_Type::EIGHT, | |
a36434b9 | 221 | 'where' => 'civicrm_subscription_history.status', |
522a26c9 | 222 | 'table_name' => 'civicrm_subscription_history', |
223 | 'entity' => 'SubscriptionHistory', | |
224 | 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', | |
6a7e5e5d | 225 | 'localizable' => 0, |
c3fc2621 | 226 | 'pseudoconstant' => [ |
e501603b | 227 | 'callback' => 'CRM_Core_SelectValues::groupContactStatus', |
e6ca0a57 | 228 | ], |
a9d0587b | 229 | 'add' => '1.1', |
c3fc2621 CW |
230 | ], |
231 | 'tracking' => [ | |
e501603b TO |
232 | 'name' => 'tracking', |
233 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 234 | 'title' => ts('Group Membership Tracking'), |
215b423e | 235 | 'description' => ts('IP address or other tracking info'), |
e501603b TO |
236 | 'maxlength' => 255, |
237 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 238 | 'where' => 'civicrm_subscription_history.tracking', |
522a26c9 | 239 | 'table_name' => 'civicrm_subscription_history', |
240 | 'entity' => 'SubscriptionHistory', | |
241 | 'bao' => 'CRM_Contact_BAO_SubscriptionHistory', | |
6a7e5e5d | 242 | 'localizable' => 0, |
a9d0587b | 243 | 'add' => '1.1', |
c3fc2621 CW |
244 | ], |
245 | ]; | |
346aaaba | 246 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 247 | } |
346aaaba | 248 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 249 | } |
c3fc2621 | 250 | |
e501603b | 251 | /** |
bd8e0b14 | 252 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
253 | * |
254 | * @return array | |
bd8e0b14 | 255 | * Array(string $name => string $uniqueName). |
e501603b | 256 | */ |
c3fc2621 | 257 | public static function &fieldKeys() { |
bd8e0b14 TO |
258 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
259 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 260 | } |
bd8e0b14 | 261 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 262 | } |
c3fc2621 | 263 | |
e501603b TO |
264 | /** |
265 | * Returns the names of this table | |
266 | * | |
267 | * @return string | |
268 | */ | |
c3fc2621 | 269 | public static function getTableName() { |
e501603b TO |
270 | return self::$_tableName; |
271 | } | |
c3fc2621 | 272 | |
e501603b TO |
273 | /** |
274 | * Returns if this table needs to be logged | |
275 | * | |
c3fc2621 | 276 | * @return bool |
e501603b | 277 | */ |
c3fc2621 | 278 | public function getLog() { |
e501603b TO |
279 | return self::$_log; |
280 | } | |
c3fc2621 | 281 | |
e501603b TO |
282 | /** |
283 | * Returns the list of fields that can be imported | |
284 | * | |
285 | * @param bool $prefix | |
286 | * | |
287 | * @return array | |
288 | */ | |
c3fc2621 CW |
289 | public static function &import($prefix = FALSE) { |
290 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'subscription_history', $prefix, []); | |
60808919 | 291 | return $r; |
e501603b | 292 | } |
c3fc2621 | 293 | |
e501603b TO |
294 | /** |
295 | * Returns the list of fields that can be exported | |
296 | * | |
297 | * @param bool $prefix | |
298 | * | |
299 | * @return array | |
300 | */ | |
c3fc2621 CW |
301 | public static function &export($prefix = FALSE) { |
302 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'subscription_history', $prefix, []); | |
60808919 | 303 | return $r; |
e501603b | 304 | } |
c3fc2621 | 305 | |
e7a6b91a AS |
306 | /** |
307 | * Returns the list of indices | |
c3fc2621 CW |
308 | * |
309 | * @param bool $localize | |
310 | * | |
311 | * @return array | |
e7a6b91a AS |
312 | */ |
313 | public static function indices($localize = TRUE) { | |
c3fc2621 | 314 | $indices = []; |
e7a6b91a AS |
315 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
316 | } | |
c3fc2621 | 317 | |
e501603b | 318 | } |