DAOs with singular/plural options for entity titles
[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:41a2f33a589d43ba388d36dcf8f9e54f)
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
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_mailing_bounce_type';
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 * @var int
35 */
36 public $id;
37
38 /**
39 * Type of bounce
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * A description of this bounce type
47 *
48 * @var string
49 */
50 public $description;
51
52 /**
53 * Number of bounces of this type required before the email address is put on bounce hold
54 *
55 * @var int
56 */
57 public $hold_threshold;
58
59 /**
60 * Class constructor.
61 */
62 public function __construct() {
63 $this->__table = 'civicrm_mailing_bounce_type';
64 parent::__construct();
65 }
66
67 /**
68 * Returns localized title of this entity.
69 *
70 * @param bool $plural
71 * Whether to return the plural version of the title.
72 */
73 public static function getEntityTitle($plural = FALSE) {
74 return $plural ? ts('Bounce Types') : ts('Bounce Type');
75 }
76
77 /**
78 * Returns all the column names of this table
79 *
80 * @return array
81 */
82 public static function &fields() {
83 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
84 Civi::$statics[__CLASS__]['fields'] = [
85 'id' => [
86 'name' => 'id',
87 'type' => CRM_Utils_Type::T_INT,
88 'title' => ts('Bounce Type ID'),
89 'required' => TRUE,
90 'where' => 'civicrm_mailing_bounce_type.id',
91 'table_name' => 'civicrm_mailing_bounce_type',
92 'entity' => 'BounceType',
93 'bao' => 'CRM_Mailing_DAO_BounceType',
94 'localizable' => 0,
95 'add' => NULL,
96 ],
97 'name' => [
98 'name' => 'name',
99 'type' => CRM_Utils_Type::T_STRING,
100 'title' => ts('Bounce Type Name'),
101 'description' => ts('Type of bounce'),
102 'required' => TRUE,
103 'maxlength' => 24,
104 'size' => CRM_Utils_Type::MEDIUM,
105 'where' => 'civicrm_mailing_bounce_type.name',
106 'table_name' => 'civicrm_mailing_bounce_type',
107 'entity' => 'BounceType',
108 'bao' => 'CRM_Mailing_DAO_BounceType',
109 'localizable' => 0,
110 'add' => NULL,
111 ],
112 'description' => [
113 'name' => 'description',
114 'type' => CRM_Utils_Type::T_STRING,
115 'title' => ts('Bounce Type Description'),
116 'description' => ts('A description of this bounce type'),
117 'maxlength' => 255,
118 'size' => CRM_Utils_Type::HUGE,
119 'where' => 'civicrm_mailing_bounce_type.description',
120 'table_name' => 'civicrm_mailing_bounce_type',
121 'entity' => 'BounceType',
122 'bao' => 'CRM_Mailing_DAO_BounceType',
123 'localizable' => 0,
124 'add' => NULL,
125 ],
126 'hold_threshold' => [
127 'name' => 'hold_threshold',
128 'type' => CRM_Utils_Type::T_INT,
129 'title' => ts('Hold Threshold'),
130 'description' => ts('Number of bounces of this type required before the email address is put on bounce hold'),
131 'required' => TRUE,
132 'where' => 'civicrm_mailing_bounce_type.hold_threshold',
133 'table_name' => 'civicrm_mailing_bounce_type',
134 'entity' => 'BounceType',
135 'bao' => 'CRM_Mailing_DAO_BounceType',
136 'localizable' => 0,
137 'add' => NULL,
138 ],
139 ];
140 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
141 }
142 return Civi::$statics[__CLASS__]['fields'];
143 }
144
145 /**
146 * Return a mapping from field-name to the corresponding key (as used in fields()).
147 *
148 * @return array
149 * Array(string $name => string $uniqueName).
150 */
151 public static function &fieldKeys() {
152 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
153 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
154 }
155 return Civi::$statics[__CLASS__]['fieldKeys'];
156 }
157
158 /**
159 * Returns the names of this table
160 *
161 * @return string
162 */
163 public static function getTableName() {
164 return self::$_tableName;
165 }
166
167 /**
168 * Returns if this table needs to be logged
169 *
170 * @return bool
171 */
172 public function getLog() {
173 return self::$_log;
174 }
175
176 /**
177 * Returns the list of fields that can be imported
178 *
179 * @param bool $prefix
180 *
181 * @return array
182 */
183 public static function &import($prefix = FALSE) {
184 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_bounce_type', $prefix, []);
185 return $r;
186 }
187
188 /**
189 * Returns the list of fields that can be exported
190 *
191 * @param bool $prefix
192 *
193 * @return array
194 */
195 public static function &export($prefix = FALSE) {
196 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_bounce_type', $prefix, []);
197 return $r;
198 }
199
200 /**
201 * Returns the list of indices
202 *
203 * @param bool $localize
204 *
205 * @return array
206 */
207 public static function indices($localize = TRUE) {
208 $indices = [];
209 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
210 }
211
212 }