Add "labelField" metadata to entities
[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:d85cecf66659cee08c967e8671ba7b6d)
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 'add' => NULL,
97 ],
98 'name' => [
99 'name' => 'name',
100 'type' => CRM_Utils_Type::T_STRING,
101 'title' => ts('Bounce Type Name'),
102 'description' => ts('Type of bounce'),
103 'required' => TRUE,
104 'maxlength' => 24,
105 'size' => CRM_Utils_Type::MEDIUM,
106 'where' => 'civicrm_mailing_bounce_type.name',
107 'table_name' => 'civicrm_mailing_bounce_type',
108 'entity' => 'BounceType',
109 'bao' => 'CRM_Mailing_DAO_BounceType',
110 'localizable' => 0,
111 'add' => NULL,
112 ],
113 'description' => [
114 'name' => 'description',
115 'type' => CRM_Utils_Type::T_STRING,
116 'title' => ts('Bounce Type Description'),
117 'description' => ts('A description of this bounce type'),
118 'maxlength' => 255,
119 'size' => CRM_Utils_Type::HUGE,
120 'where' => 'civicrm_mailing_bounce_type.description',
121 'table_name' => 'civicrm_mailing_bounce_type',
122 'entity' => 'BounceType',
123 'bao' => 'CRM_Mailing_DAO_BounceType',
124 'localizable' => 0,
125 'add' => NULL,
126 ],
127 'hold_threshold' => [
128 'name' => 'hold_threshold',
129 'type' => CRM_Utils_Type::T_INT,
130 'title' => ts('Hold Threshold'),
131 'description' => ts('Number of bounces of this type required before the email address is put on bounce hold'),
132 'required' => TRUE,
133 'where' => 'civicrm_mailing_bounce_type.hold_threshold',
134 'table_name' => 'civicrm_mailing_bounce_type',
135 'entity' => 'BounceType',
136 'bao' => 'CRM_Mailing_DAO_BounceType',
137 'localizable' => 0,
138 'add' => NULL,
139 ],
140 ];
141 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
142 }
143 return Civi::$statics[__CLASS__]['fields'];
144 }
145
146 /**
147 * Return a mapping from field-name to the corresponding key (as used in fields()).
148 *
149 * @return array
150 * Array(string $name => string $uniqueName).
151 */
152 public static function &fieldKeys() {
153 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
154 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
155 }
156 return Civi::$statics[__CLASS__]['fieldKeys'];
157 }
158
159 /**
160 * Returns the names of this table
161 *
162 * @return string
163 */
164 public static function getTableName() {
165 return self::$_tableName;
166 }
167
168 /**
169 * Returns if this table needs to be logged
170 *
171 * @return bool
172 */
173 public function getLog() {
174 return self::$_log;
175 }
176
177 /**
178 * Returns the list of fields that can be imported
179 *
180 * @param bool $prefix
181 *
182 * @return array
183 */
184 public static function &import($prefix = FALSE) {
185 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_bounce_type', $prefix, []);
186 return $r;
187 }
188
189 /**
190 * Returns the list of fields that can be exported
191 *
192 * @param bool $prefix
193 *
194 * @return array
195 */
196 public static function &export($prefix = FALSE) {
197 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_bounce_type', $prefix, []);
198 return $r;
199 }
200
201 /**
202 * Returns the list of indices
203 *
204 * @param bool $localize
205 *
206 * @return array
207 */
208 public static function indices($localize = TRUE) {
209 $indices = [];
210 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
211 }
212
213 }