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