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/Mailing/Event/Subscribe.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
d31fb4e3 | 9 | * (GenCodeChecksum:c1a80e519891849628fc022202ebab69) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Subscribe entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Mailing_Event_DAO_Subscribe extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = ''; | |
d31fb4e3 | 18 | const COMPONENT = 'CiviMail'; |
c3fc2621 | 19 | |
e501603b | 20 | /** |
f41f0342 | 21 | * Static instance to hold the table name. |
e501603b TO |
22 | * |
23 | * @var string | |
24 | */ | |
fa45b5b9 | 25 | public static $_tableName = 'civicrm_mailing_event_subscribe'; |
c3fc2621 | 26 | |
e501603b | 27 | /** |
f41f0342 | 28 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 29 | * |
c3fc2621 | 30 | * @var bool |
e501603b | 31 | */ |
fa45b5b9 | 32 | public static $_log = FALSE; |
c3fc2621 | 33 | |
e501603b | 34 | /** |
e6ca0a57 | 35 | * @var int |
e501603b TO |
36 | */ |
37 | public $id; | |
c3fc2621 | 38 | |
e501603b TO |
39 | /** |
40 | * FK to Group | |
41 | * | |
e6ca0a57 | 42 | * @var int |
e501603b TO |
43 | */ |
44 | public $group_id; | |
c3fc2621 | 45 | |
e501603b TO |
46 | /** |
47 | * FK to Contact | |
48 | * | |
e6ca0a57 | 49 | * @var int |
e501603b TO |
50 | */ |
51 | public $contact_id; | |
c3fc2621 | 52 | |
e501603b TO |
53 | /** |
54 | * Security hash | |
55 | * | |
56 | * @var string | |
57 | */ | |
58 | public $hash; | |
c3fc2621 | 59 | |
e501603b TO |
60 | /** |
61 | * When this subscription event occurred. | |
62 | * | |
6c2b97b7 | 63 | * @var timestamp |
e501603b TO |
64 | */ |
65 | public $time_stamp; | |
c3fc2621 | 66 | |
e501603b | 67 | /** |
f41f0342 | 68 | * Class constructor. |
e501603b | 69 | */ |
c3fc2621 | 70 | public function __construct() { |
e501603b TO |
71 | $this->__table = 'civicrm_mailing_event_subscribe'; |
72 | parent::__construct(); | |
73 | } | |
c3fc2621 | 74 | |
449c4e6b CW |
75 | /** |
76 | * Returns localized title of this entity. | |
7b66c3b5 AH |
77 | * |
78 | * @param bool $plural | |
79 | * Whether to return the plural version of the title. | |
449c4e6b | 80 | */ |
7b66c3b5 AH |
81 | public static function getEntityTitle($plural = FALSE) { |
82 | return $plural ? ts('Subscribes') : ts('Subscribe'); | |
449c4e6b CW |
83 | } |
84 | ||
e501603b | 85 | /** |
f41f0342 | 86 | * Returns foreign keys and entity references. |
e501603b TO |
87 | * |
88 | * @return array | |
89 | * [CRM_Core_Reference_Interface] | |
90 | */ | |
c3fc2621 | 91 | public static function getReferenceColumns() { |
346aaaba | 92 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
a36434b9 | 93 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
94 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); |
95 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); | |
346aaaba | 96 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 97 | } |
346aaaba | 98 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 99 | } |
c3fc2621 | 100 | |
e501603b TO |
101 | /** |
102 | * Returns all the column names of this table | |
103 | * | |
104 | * @return array | |
105 | */ | |
c3fc2621 | 106 | public static function &fields() { |
346aaaba | 107 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
108 | Civi::$statics[__CLASS__]['fields'] = [ |
109 | 'id' => [ | |
e501603b TO |
110 | 'name' => 'id', |
111 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 CW |
112 | 'title' => ts('Mailing Subscribe ID'), |
113 | 'required' => TRUE, | |
a36434b9 | 114 | 'where' => 'civicrm_mailing_event_subscribe.id', |
522a26c9 | 115 | 'table_name' => 'civicrm_mailing_event_subscribe', |
116 | 'entity' => 'Subscribe', | |
117 | 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', | |
6a7e5e5d | 118 | 'localizable' => 0, |
a9d0587b | 119 | 'add' => NULL, |
c3fc2621 CW |
120 | ], |
121 | 'group_id' => [ | |
e501603b TO |
122 | 'name' => 'group_id', |
123 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 124 | 'title' => ts('Mailing Subscribe Group'), |
215b423e | 125 | 'description' => ts('FK to Group'), |
c3fc2621 | 126 | 'required' => TRUE, |
a36434b9 | 127 | 'where' => 'civicrm_mailing_event_subscribe.group_id', |
522a26c9 | 128 | 'table_name' => 'civicrm_mailing_event_subscribe', |
129 | 'entity' => 'Subscribe', | |
130 | 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', | |
6a7e5e5d | 131 | 'localizable' => 0, |
e501603b | 132 | 'FKClassName' => 'CRM_Contact_DAO_Group', |
c3fc2621 | 133 | 'html' => [ |
e501603b | 134 | 'type' => 'Select', |
c3fc2621 CW |
135 | ], |
136 | 'pseudoconstant' => [ | |
e501603b TO |
137 | 'table' => 'civicrm_group', |
138 | 'keyColumn' => 'id', | |
139 | 'labelColumn' => 'title', | |
e6ca0a57 | 140 | ], |
a9d0587b | 141 | 'add' => NULL, |
c3fc2621 CW |
142 | ], |
143 | 'contact_id' => [ | |
e501603b TO |
144 | 'name' => 'contact_id', |
145 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 146 | 'title' => ts('Mailing Subscribe Contact'), |
215b423e | 147 | 'description' => ts('FK to Contact'), |
c3fc2621 | 148 | 'required' => TRUE, |
a36434b9 | 149 | 'where' => 'civicrm_mailing_event_subscribe.contact_id', |
522a26c9 | 150 | 'table_name' => 'civicrm_mailing_event_subscribe', |
151 | 'entity' => 'Subscribe', | |
152 | 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', | |
6a7e5e5d | 153 | 'localizable' => 0, |
e501603b | 154 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
a9d0587b | 155 | 'add' => NULL, |
c3fc2621 CW |
156 | ], |
157 | 'hash' => [ | |
e501603b TO |
158 | 'name' => 'hash', |
159 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 160 | 'title' => ts('Mailing Subscribe Hash'), |
215b423e | 161 | 'description' => ts('Security hash'), |
c3fc2621 | 162 | 'required' => TRUE, |
e501603b TO |
163 | 'maxlength' => 255, |
164 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 165 | 'where' => 'civicrm_mailing_event_subscribe.hash', |
522a26c9 | 166 | 'table_name' => 'civicrm_mailing_event_subscribe', |
167 | 'entity' => 'Subscribe', | |
168 | 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', | |
6a7e5e5d | 169 | 'localizable' => 0, |
a9d0587b | 170 | 'add' => NULL, |
c3fc2621 CW |
171 | ], |
172 | 'time_stamp' => [ | |
e501603b | 173 | 'name' => 'time_stamp', |
6c2b97b7 | 174 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
c3fc2621 | 175 | 'title' => ts('Mailing Subscribe Timestamp'), |
215b423e | 176 | 'description' => ts('When this subscription event occurred.'), |
c3fc2621 | 177 | 'required' => TRUE, |
a36434b9 | 178 | 'where' => 'civicrm_mailing_event_subscribe.time_stamp', |
6c2b97b7 | 179 | 'default' => 'CURRENT_TIMESTAMP', |
522a26c9 | 180 | 'table_name' => 'civicrm_mailing_event_subscribe', |
181 | 'entity' => 'Subscribe', | |
182 | 'bao' => 'CRM_Mailing_Event_BAO_Subscribe', | |
6a7e5e5d | 183 | 'localizable' => 0, |
a9d0587b | 184 | 'add' => NULL, |
c3fc2621 CW |
185 | ], |
186 | ]; | |
346aaaba | 187 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 188 | } |
346aaaba | 189 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 190 | } |
c3fc2621 | 191 | |
e501603b | 192 | /** |
bd8e0b14 | 193 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
194 | * |
195 | * @return array | |
bd8e0b14 | 196 | * Array(string $name => string $uniqueName). |
e501603b | 197 | */ |
c3fc2621 | 198 | public static function &fieldKeys() { |
bd8e0b14 TO |
199 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
200 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 201 | } |
bd8e0b14 | 202 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 203 | } |
c3fc2621 | 204 | |
e501603b TO |
205 | /** |
206 | * Returns the names of this table | |
207 | * | |
208 | * @return string | |
209 | */ | |
c3fc2621 | 210 | public static function getTableName() { |
e501603b TO |
211 | return self::$_tableName; |
212 | } | |
c3fc2621 | 213 | |
e501603b TO |
214 | /** |
215 | * Returns if this table needs to be logged | |
216 | * | |
c3fc2621 | 217 | * @return bool |
e501603b | 218 | */ |
c3fc2621 | 219 | public function getLog() { |
e501603b TO |
220 | return self::$_log; |
221 | } | |
c3fc2621 | 222 | |
e501603b TO |
223 | /** |
224 | * Returns the list of fields that can be imported | |
225 | * | |
226 | * @param bool $prefix | |
227 | * | |
228 | * @return array | |
229 | */ | |
c3fc2621 CW |
230 | public static function &import($prefix = FALSE) { |
231 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_subscribe', $prefix, []); | |
60808919 | 232 | return $r; |
e501603b | 233 | } |
c3fc2621 | 234 | |
e501603b TO |
235 | /** |
236 | * Returns the list of fields that can be exported | |
237 | * | |
238 | * @param bool $prefix | |
239 | * | |
240 | * @return array | |
241 | */ | |
c3fc2621 CW |
242 | public static function &export($prefix = FALSE) { |
243 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_subscribe', $prefix, []); | |
60808919 | 244 | return $r; |
e501603b | 245 | } |
c3fc2621 | 246 | |
e7a6b91a AS |
247 | /** |
248 | * Returns the list of indices | |
c3fc2621 CW |
249 | * |
250 | * @param bool $localize | |
251 | * | |
252 | * @return array | |
e7a6b91a AS |
253 | */ |
254 | public static function indices($localize = TRUE) { | |
c3fc2621 | 255 | $indices = []; |
e7a6b91a AS |
256 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
257 | } | |
c3fc2621 | 258 | |
e501603b | 259 | } |