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