Merge pull request #17712 from civicrm/5.27
[civicrm-core.git] / CRM / Core / DAO / MailSettings.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/MailSettings.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:1c0272c8ff0392b03ef4a1f6ab23c0df)
10 */
11
12 /**
13 * Database access object for the MailSettings entity.
14 */
15 class CRM_Core_DAO_MailSettings extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_mail_settings';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * primary key
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Which Domain is this match entry for
40 *
41 * @var int
42 */
43 public $domain_id;
44
45 /**
46 * name of this group of settings
47 *
48 * @var string
49 */
50 public $name;
51
52 /**
53 * whether this is the default set of settings for this domain
54 *
55 * @var bool
56 */
57 public $is_default;
58
59 /**
60 * email address domain (the part after @)
61 *
62 * @var string
63 */
64 public $domain;
65
66 /**
67 * optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)
68 *
69 * @var string
70 */
71 public $localpart;
72
73 /**
74 * contents of the Return-Path header
75 *
76 * @var string
77 */
78 public $return_path;
79
80 /**
81 * name of the protocol to use for polling (like IMAP, POP3 or Maildir)
82 *
83 * @var string
84 */
85 public $protocol;
86
87 /**
88 * server to use when polling
89 *
90 * @var string
91 */
92 public $server;
93
94 /**
95 * port to use when polling
96 *
97 * @var int
98 */
99 public $port;
100
101 /**
102 * username to use when polling
103 *
104 * @var string
105 */
106 public $username;
107
108 /**
109 * password to use when polling
110 *
111 * @var string
112 */
113 public $password;
114
115 /**
116 * whether to use SSL or not
117 *
118 * @var bool
119 */
120 public $is_ssl;
121
122 /**
123 * folder to poll from when using IMAP, path to poll from when using Maildir, etc.
124 *
125 * @var string
126 */
127 public $source;
128
129 /**
130 * Name of status to use when creating email to activity.
131 *
132 * @var string
133 */
134 public $activity_status;
135
136 /**
137 * Class constructor.
138 */
139 public function __construct() {
140 $this->__table = 'civicrm_mail_settings';
141 parent::__construct();
142 }
143
144 /**
145 * Returns localized title of this entity.
146 */
147 public static function getEntityTitle() {
148 return ts('Mail Settingses');
149 }
150
151 /**
152 * Returns foreign keys and entity references.
153 *
154 * @return array
155 * [CRM_Core_Reference_Interface]
156 */
157 public static function getReferenceColumns() {
158 if (!isset(Civi::$statics[__CLASS__]['links'])) {
159 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
160 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
161 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
162 }
163 return Civi::$statics[__CLASS__]['links'];
164 }
165
166 /**
167 * Returns all the column names of this table
168 *
169 * @return array
170 */
171 public static function &fields() {
172 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
173 Civi::$statics[__CLASS__]['fields'] = [
174 'id' => [
175 'name' => 'id',
176 'type' => CRM_Utils_Type::T_INT,
177 'title' => ts('Mail Settings ID'),
178 'description' => ts('primary key'),
179 'required' => TRUE,
180 'where' => 'civicrm_mail_settings.id',
181 'table_name' => 'civicrm_mail_settings',
182 'entity' => 'MailSettings',
183 'bao' => 'CRM_Core_BAO_MailSettings',
184 'localizable' => 0,
185 ],
186 'domain_id' => [
187 'name' => 'domain_id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Mail Settings Domain'),
190 'description' => ts('Which Domain is this match entry for'),
191 'required' => TRUE,
192 'where' => 'civicrm_mail_settings.domain_id',
193 'table_name' => 'civicrm_mail_settings',
194 'entity' => 'MailSettings',
195 'bao' => 'CRM_Core_BAO_MailSettings',
196 'localizable' => 0,
197 'FKClassName' => 'CRM_Core_DAO_Domain',
198 'pseudoconstant' => [
199 'table' => 'civicrm_domain',
200 'keyColumn' => 'id',
201 'labelColumn' => 'name',
202 ],
203 ],
204 'name' => [
205 'name' => 'name',
206 'type' => CRM_Utils_Type::T_STRING,
207 'title' => ts('Mail Settings Name'),
208 'description' => ts('name of this group of settings'),
209 'maxlength' => 255,
210 'size' => CRM_Utils_Type::HUGE,
211 'where' => 'civicrm_mail_settings.name',
212 'table_name' => 'civicrm_mail_settings',
213 'entity' => 'MailSettings',
214 'bao' => 'CRM_Core_BAO_MailSettings',
215 'localizable' => 0,
216 ],
217 'is_default' => [
218 'name' => 'is_default',
219 'type' => CRM_Utils_Type::T_BOOLEAN,
220 'title' => ts('Is Default Mail Settings?'),
221 'description' => ts('whether this is the default set of settings for this domain'),
222 'where' => 'civicrm_mail_settings.is_default',
223 'table_name' => 'civicrm_mail_settings',
224 'entity' => 'MailSettings',
225 'bao' => 'CRM_Core_BAO_MailSettings',
226 'localizable' => 0,
227 ],
228 'domain' => [
229 'name' => 'domain',
230 'type' => CRM_Utils_Type::T_STRING,
231 'title' => ts('email Domain'),
232 'description' => ts('email address domain (the part after @)'),
233 'maxlength' => 255,
234 'size' => CRM_Utils_Type::HUGE,
235 'where' => 'civicrm_mail_settings.domain',
236 'table_name' => 'civicrm_mail_settings',
237 'entity' => 'MailSettings',
238 'bao' => 'CRM_Core_BAO_MailSettings',
239 'localizable' => 0,
240 ],
241 'localpart' => [
242 'name' => 'localpart',
243 'type' => CRM_Utils_Type::T_STRING,
244 'title' => ts('email Local Part'),
245 'description' => ts('optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)'),
246 'maxlength' => 255,
247 'size' => CRM_Utils_Type::HUGE,
248 'where' => 'civicrm_mail_settings.localpart',
249 'table_name' => 'civicrm_mail_settings',
250 'entity' => 'MailSettings',
251 'bao' => 'CRM_Core_BAO_MailSettings',
252 'localizable' => 0,
253 ],
254 'return_path' => [
255 'name' => 'return_path',
256 'type' => CRM_Utils_Type::T_STRING,
257 'title' => ts('Return Path'),
258 'description' => ts('contents of the Return-Path header'),
259 'maxlength' => 255,
260 'size' => CRM_Utils_Type::HUGE,
261 'where' => 'civicrm_mail_settings.return_path',
262 'table_name' => 'civicrm_mail_settings',
263 'entity' => 'MailSettings',
264 'bao' => 'CRM_Core_BAO_MailSettings',
265 'localizable' => 0,
266 ],
267 'protocol' => [
268 'name' => 'protocol',
269 'type' => CRM_Utils_Type::T_STRING,
270 'title' => ts('Protocol'),
271 'description' => ts('name of the protocol to use for polling (like IMAP, POP3 or Maildir)'),
272 'maxlength' => 255,
273 'size' => CRM_Utils_Type::HUGE,
274 'where' => 'civicrm_mail_settings.protocol',
275 'table_name' => 'civicrm_mail_settings',
276 'entity' => 'MailSettings',
277 'bao' => 'CRM_Core_BAO_MailSettings',
278 'localizable' => 0,
279 'html' => [
280 'type' => 'Select',
281 ],
282 'pseudoconstant' => [
283 'optionGroupName' => 'mail_protocol',
284 'optionEditPath' => 'civicrm/admin/options/mail_protocol',
285 ],
286 ],
287 'server' => [
288 'name' => 'server',
289 'type' => CRM_Utils_Type::T_STRING,
290 'title' => ts('Mail Server'),
291 'description' => ts('server to use when polling'),
292 'maxlength' => 255,
293 'size' => CRM_Utils_Type::HUGE,
294 'where' => 'civicrm_mail_settings.server',
295 'table_name' => 'civicrm_mail_settings',
296 'entity' => 'MailSettings',
297 'bao' => 'CRM_Core_BAO_MailSettings',
298 'localizable' => 0,
299 ],
300 'port' => [
301 'name' => 'port',
302 'type' => CRM_Utils_Type::T_INT,
303 'title' => ts('Mail Port'),
304 'description' => ts('port to use when polling'),
305 'where' => 'civicrm_mail_settings.port',
306 'table_name' => 'civicrm_mail_settings',
307 'entity' => 'MailSettings',
308 'bao' => 'CRM_Core_BAO_MailSettings',
309 'localizable' => 0,
310 ],
311 'username' => [
312 'name' => 'username',
313 'type' => CRM_Utils_Type::T_STRING,
314 'title' => ts('Mail Account Username'),
315 'description' => ts('username to use when polling'),
316 'maxlength' => 255,
317 'size' => CRM_Utils_Type::HUGE,
318 'where' => 'civicrm_mail_settings.username',
319 'table_name' => 'civicrm_mail_settings',
320 'entity' => 'MailSettings',
321 'bao' => 'CRM_Core_BAO_MailSettings',
322 'localizable' => 0,
323 ],
324 'password' => [
325 'name' => 'password',
326 'type' => CRM_Utils_Type::T_STRING,
327 'title' => ts('Mail Account Password'),
328 'description' => ts('password to use when polling'),
329 'maxlength' => 255,
330 'size' => CRM_Utils_Type::HUGE,
331 'where' => 'civicrm_mail_settings.password',
332 'table_name' => 'civicrm_mail_settings',
333 'entity' => 'MailSettings',
334 'bao' => 'CRM_Core_BAO_MailSettings',
335 'localizable' => 0,
336 ],
337 'is_ssl' => [
338 'name' => 'is_ssl',
339 'type' => CRM_Utils_Type::T_BOOLEAN,
340 'title' => ts('Mail Account Uses SSL'),
341 'description' => ts('whether to use SSL or not'),
342 'where' => 'civicrm_mail_settings.is_ssl',
343 'table_name' => 'civicrm_mail_settings',
344 'entity' => 'MailSettings',
345 'bao' => 'CRM_Core_BAO_MailSettings',
346 'localizable' => 0,
347 ],
348 'source' => [
349 'name' => 'source',
350 'type' => CRM_Utils_Type::T_STRING,
351 'title' => ts('Mail Folder'),
352 'description' => ts('folder to poll from when using IMAP, path to poll from when using Maildir, etc.'),
353 'maxlength' => 255,
354 'size' => CRM_Utils_Type::HUGE,
355 'where' => 'civicrm_mail_settings.source',
356 'table_name' => 'civicrm_mail_settings',
357 'entity' => 'MailSettings',
358 'bao' => 'CRM_Core_BAO_MailSettings',
359 'localizable' => 0,
360 ],
361 'activity_status' => [
362 'name' => 'activity_status',
363 'type' => CRM_Utils_Type::T_STRING,
364 'title' => ts('Activity Status'),
365 'description' => ts('Name of status to use when creating email to activity.'),
366 'maxlength' => 255,
367 'size' => CRM_Utils_Type::HUGE,
368 'where' => 'civicrm_mail_settings.activity_status',
369 'table_name' => 'civicrm_mail_settings',
370 'entity' => 'MailSettings',
371 'bao' => 'CRM_Core_BAO_MailSettings',
372 'localizable' => 0,
373 'html' => [
374 'type' => 'Select',
375 ],
376 'pseudoconstant' => [
377 'optionGroupName' => 'activity_status',
378 'keyColumn' => 'name',
379 'optionEditPath' => 'civicrm/admin/options/activity_status',
380 ],
381 ],
382 ];
383 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
384 }
385 return Civi::$statics[__CLASS__]['fields'];
386 }
387
388 /**
389 * Return a mapping from field-name to the corresponding key (as used in fields()).
390 *
391 * @return array
392 * Array(string $name => string $uniqueName).
393 */
394 public static function &fieldKeys() {
395 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
396 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
397 }
398 return Civi::$statics[__CLASS__]['fieldKeys'];
399 }
400
401 /**
402 * Returns the names of this table
403 *
404 * @return string
405 */
406 public static function getTableName() {
407 return self::$_tableName;
408 }
409
410 /**
411 * Returns if this table needs to be logged
412 *
413 * @return bool
414 */
415 public function getLog() {
416 return self::$_log;
417 }
418
419 /**
420 * Returns the list of fields that can be imported
421 *
422 * @param bool $prefix
423 *
424 * @return array
425 */
426 public static function &import($prefix = FALSE) {
427 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mail_settings', $prefix, []);
428 return $r;
429 }
430
431 /**
432 * Returns the list of fields that can be exported
433 *
434 * @param bool $prefix
435 *
436 * @return array
437 */
438 public static function &export($prefix = FALSE) {
439 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mail_settings', $prefix, []);
440 return $r;
441 }
442
443 /**
444 * Returns the list of indices
445 *
446 * @param bool $localize
447 *
448 * @return array
449 */
450 public static function indices($localize = TRUE) {
451 $indices = [];
452 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
453 }
454
455 }