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