4e342a0d0734b94cd8036a50d0582d12bbf5e6a8
[civicrm-core.git] / CRM / Mailing / Event / DAO / Bounce.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/Event/Bounce.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7e29193742f438beea9f09856d9c7221)
10 */
11
12 /**
13 * Database access object for the Bounce entity.
14 */
15 class CRM_Mailing_Event_DAO_Bounce 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_event_bounce';
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 * FK to EventQueue
41 *
42 * @var int
43 */
44 public $event_queue_id;
45
46 /**
47 * What type of bounce was it?
48 *
49 * @var int
50 */
51 public $bounce_type_id;
52
53 /**
54 * The reason the email bounced.
55 *
56 * @var string
57 */
58 public $bounce_reason;
59
60 /**
61 * When this bounce event occurred.
62 *
63 * @var timestamp
64 */
65 public $time_stamp;
66
67 /**
68 * Class constructor.
69 */
70 public function __construct() {
71 $this->__table = 'civicrm_mailing_event_bounce';
72 parent::__construct();
73 }
74
75 /**
76 * Returns localized title of this entity.
77 *
78 * @param bool $plural
79 * Whether to return the plural version of the title.
80 */
81 public static function getEntityTitle($plural = FALSE) {
82 return $plural ? ts('Mailing Bounce Events') : ts('Mailing Bounce Event');
83 }
84
85 /**
86 * Returns foreign keys and entity references.
87 *
88 * @return array
89 * [CRM_Core_Reference_Interface]
90 */
91 public static function getReferenceColumns() {
92 if (!isset(Civi::$statics[__CLASS__]['links'])) {
93 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
94 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id');
95 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
96 }
97 return Civi::$statics[__CLASS__]['links'];
98 }
99
100 /**
101 * Returns all the column names of this table
102 *
103 * @return array
104 */
105 public static function &fields() {
106 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
107 Civi::$statics[__CLASS__]['fields'] = [
108 'id' => [
109 'name' => 'id',
110 'type' => CRM_Utils_Type::T_INT,
111 'title' => ts('Bounce ID'),
112 'required' => TRUE,
113 'where' => 'civicrm_mailing_event_bounce.id',
114 'table_name' => 'civicrm_mailing_event_bounce',
115 'entity' => 'Bounce',
116 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
117 'localizable' => 0,
118 'html' => [
119 'type' => 'Number',
120 ],
121 'readonly' => TRUE,
122 'add' => NULL,
123 ],
124 'event_queue_id' => [
125 'name' => 'event_queue_id',
126 'type' => CRM_Utils_Type::T_INT,
127 'title' => ts('Event Queue ID'),
128 'description' => ts('FK to EventQueue'),
129 'required' => TRUE,
130 'where' => 'civicrm_mailing_event_bounce.event_queue_id',
131 'table_name' => 'civicrm_mailing_event_bounce',
132 'entity' => 'Bounce',
133 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
134 'localizable' => 0,
135 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
136 'html' => [
137 'label' => ts("Event Queue"),
138 ],
139 'add' => NULL,
140 ],
141 'bounce_type_id' => [
142 'name' => 'bounce_type_id',
143 'type' => CRM_Utils_Type::T_INT,
144 'title' => ts('Bounce Type'),
145 'description' => ts('What type of bounce was it?'),
146 'where' => 'civicrm_mailing_event_bounce.bounce_type_id',
147 'table_name' => 'civicrm_mailing_event_bounce',
148 'entity' => 'Bounce',
149 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
150 'localizable' => 0,
151 'html' => [
152 'type' => 'Select',
153 ],
154 'pseudoconstant' => [
155 'table' => 'civicrm_mailing_bounce_type',
156 'keyColumn' => 'id',
157 'labelColumn' => 'name',
158 ],
159 'add' => NULL,
160 ],
161 'bounce_reason' => [
162 'name' => 'bounce_reason',
163 'type' => CRM_Utils_Type::T_STRING,
164 'title' => ts('Bounce Reason'),
165 'description' => ts('The reason the email bounced.'),
166 'maxlength' => 255,
167 'size' => CRM_Utils_Type::HUGE,
168 'where' => 'civicrm_mailing_event_bounce.bounce_reason',
169 'table_name' => 'civicrm_mailing_event_bounce',
170 'entity' => 'Bounce',
171 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
172 'localizable' => 0,
173 'add' => NULL,
174 ],
175 'time_stamp' => [
176 'name' => 'time_stamp',
177 'type' => CRM_Utils_Type::T_TIMESTAMP,
178 'title' => ts('Timestamp'),
179 'description' => ts('When this bounce event occurred.'),
180 'required' => TRUE,
181 'where' => 'civicrm_mailing_event_bounce.time_stamp',
182 'default' => 'CURRENT_TIMESTAMP',
183 'table_name' => 'civicrm_mailing_event_bounce',
184 'entity' => 'Bounce',
185 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
186 'localizable' => 0,
187 'add' => NULL,
188 ],
189 ];
190 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
191 }
192 return Civi::$statics[__CLASS__]['fields'];
193 }
194
195 /**
196 * Return a mapping from field-name to the corresponding key (as used in fields()).
197 *
198 * @return array
199 * Array(string $name => string $uniqueName).
200 */
201 public static function &fieldKeys() {
202 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
203 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
204 }
205 return Civi::$statics[__CLASS__]['fieldKeys'];
206 }
207
208 /**
209 * Returns the names of this table
210 *
211 * @return string
212 */
213 public static function getTableName() {
214 return self::$_tableName;
215 }
216
217 /**
218 * Returns if this table needs to be logged
219 *
220 * @return bool
221 */
222 public function getLog() {
223 return self::$_log;
224 }
225
226 /**
227 * Returns the list of fields that can be imported
228 *
229 * @param bool $prefix
230 *
231 * @return array
232 */
233 public static function &import($prefix = FALSE) {
234 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_bounce', $prefix, []);
235 return $r;
236 }
237
238 /**
239 * Returns the list of fields that can be exported
240 *
241 * @param bool $prefix
242 *
243 * @return array
244 */
245 public static function &export($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_bounce', $prefix, []);
247 return $r;
248 }
249
250 /**
251 * Returns the list of indices
252 *
253 * @param bool $localize
254 *
255 * @return array
256 */
257 public static function indices($localize = TRUE) {
258 $indices = [];
259 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
260 }
261
262 }