Merge pull request #20059 from samuelsov/dev/core#2479
[civicrm-core.git] / CRM / Mailing / DAO / BounceType.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/BounceType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:3b880ec51ff0445ed90072824ba388c5)
10 */
11
12 /**
13 * Database access object for the BounceType entity.
14 */
15 class CRM_Mailing_DAO_BounceType extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18 const COMPONENT = 'CiviMail';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_mailing_bounce_type';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = FALSE;
33
34 /**
35 * @var int
36 */
37 public $id;
38
39 /**
40 * Type of bounce
41 *
42 * @var string
43 */
44 public $name;
45
46 /**
47 * A description of this bounce type
48 *
49 * @var string
50 */
51 public $description;
52
53 /**
54 * Number of bounces of this type required before the email address is put on bounce hold
55 *
56 * @var int
57 */
58 public $hold_threshold;
59
60 /**
61 * Class constructor.
62 */
63 public function __construct() {
64 $this->__table = 'civicrm_mailing_bounce_type';
65 parent::__construct();
66 }
67
68 /**
69 * Returns localized title of this entity.
70 *
71 * @param bool $plural
72 * Whether to return the plural version of the title.
73 */
74 public static function getEntityTitle($plural = FALSE) {
75 return $plural ? ts('Bounce Types') : ts('Bounce Type');
76 }
77
78 /**
79 * Returns all the column names of this table
80 *
81 * @return array
82 */
83 public static function &fields() {
84 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
85 Civi::$statics[__CLASS__]['fields'] = [
86 'id' => [
87 'name' => 'id',
88 'type' => CRM_Utils_Type::T_INT,
89 'title' => ts('Bounce Type ID'),
90 'required' => TRUE,
91 'where' => 'civicrm_mailing_bounce_type.id',
92 'table_name' => 'civicrm_mailing_bounce_type',
93 'entity' => 'BounceType',
94 'bao' => 'CRM_Mailing_DAO_BounceType',
95 'localizable' => 0,
96 'html' => [
97 'type' => 'Number',
98 ],
99 'readonly' => TRUE,
100 'add' => NULL,
101 ],
102 'name' => [
103 'name' => 'name',
104 'type' => CRM_Utils_Type::T_STRING,
105 'title' => ts('Bounce Type Name'),
106 'description' => ts('Type of bounce'),
107 'required' => TRUE,
108 'maxlength' => 24,
109 'size' => CRM_Utils_Type::MEDIUM,
110 'where' => 'civicrm_mailing_bounce_type.name',
111 'table_name' => 'civicrm_mailing_bounce_type',
112 'entity' => 'BounceType',
113 'bao' => 'CRM_Mailing_DAO_BounceType',
114 'localizable' => 0,
115 'add' => NULL,
116 ],
117 'description' => [
118 'name' => 'description',
119 'type' => CRM_Utils_Type::T_STRING,
120 'title' => ts('Bounce Type Description'),
121 'description' => ts('A description of this bounce type'),
122 'maxlength' => 255,
123 'size' => CRM_Utils_Type::HUGE,
124 'where' => 'civicrm_mailing_bounce_type.description',
125 'table_name' => 'civicrm_mailing_bounce_type',
126 'entity' => 'BounceType',
127 'bao' => 'CRM_Mailing_DAO_BounceType',
128 'localizable' => 0,
129 'add' => NULL,
130 ],
131 'hold_threshold' => [
132 'name' => 'hold_threshold',
133 'type' => CRM_Utils_Type::T_INT,
134 'title' => ts('Hold Threshold'),
135 'description' => ts('Number of bounces of this type required before the email address is put on bounce hold'),
136 'required' => TRUE,
137 'where' => 'civicrm_mailing_bounce_type.hold_threshold',
138 'table_name' => 'civicrm_mailing_bounce_type',
139 'entity' => 'BounceType',
140 'bao' => 'CRM_Mailing_DAO_BounceType',
141 'localizable' => 0,
142 'add' => NULL,
143 ],
144 ];
145 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
146 }
147 return Civi::$statics[__CLASS__]['fields'];
148 }
149
150 /**
151 * Return a mapping from field-name to the corresponding key (as used in fields()).
152 *
153 * @return array
154 * Array(string $name => string $uniqueName).
155 */
156 public static function &fieldKeys() {
157 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
158 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
159 }
160 return Civi::$statics[__CLASS__]['fieldKeys'];
161 }
162
163 /**
164 * Returns the names of this table
165 *
166 * @return string
167 */
168 public static function getTableName() {
169 return self::$_tableName;
170 }
171
172 /**
173 * Returns if this table needs to be logged
174 *
175 * @return bool
176 */
177 public function getLog() {
178 return self::$_log;
179 }
180
181 /**
182 * Returns the list of fields that can be imported
183 *
184 * @param bool $prefix
185 *
186 * @return array
187 */
188 public static function &import($prefix = FALSE) {
189 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_bounce_type', $prefix, []);
190 return $r;
191 }
192
193 /**
194 * Returns the list of fields that can be exported
195 *
196 * @param bool $prefix
197 *
198 * @return array
199 */
200 public static function &export($prefix = FALSE) {
201 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_bounce_type', $prefix, []);
202 return $r;
203 }
204
205 /**
206 * Returns the list of indices
207 *
208 * @param bool $localize
209 *
210 * @return array
211 */
212 public static function indices($localize = TRUE) {
213 $indices = [];
214 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
215 }
216
217 }