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