7383695c902e77cca0daf026c889140596010269
[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:ba4d55bd1a33a5d0fc17b22a3be114f7)
10 */
11
12 /**
13 * Database access object for the Bounce entity.
14 */
15 class CRM_Mailing_Event_DAO_Bounce extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_mailing_event_bounce';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * @var int
33 */
34 public $id;
35
36 /**
37 * FK to EventQueue
38 *
39 * @var int
40 */
41 public $event_queue_id;
42
43 /**
44 * What type of bounce was it?
45 *
46 * @var int
47 */
48 public $bounce_type_id;
49
50 /**
51 * The reason the email bounced.
52 *
53 * @var string
54 */
55 public $bounce_reason;
56
57 /**
58 * When this bounce event occurred.
59 *
60 * @var timestamp
61 */
62 public $time_stamp;
63
64 /**
65 * Class constructor.
66 */
67 public function __construct() {
68 $this->__table = 'civicrm_mailing_event_bounce';
69 parent::__construct();
70 }
71
72 /**
73 * Returns foreign keys and entity references.
74 *
75 * @return array
76 * [CRM_Core_Reference_Interface]
77 */
78 public static function getReferenceColumns() {
79 if (!isset(Civi::$statics[__CLASS__]['links'])) {
80 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
81 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id');
82 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
83 }
84 return Civi::$statics[__CLASS__]['links'];
85 }
86
87 /**
88 * Returns all the column names of this table
89 *
90 * @return array
91 */
92 public static function &fields() {
93 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
94 Civi::$statics[__CLASS__]['fields'] = [
95 'id' => [
96 'name' => 'id',
97 'type' => CRM_Utils_Type::T_INT,
98 'title' => ts('Bounce ID'),
99 'required' => TRUE,
100 'where' => 'civicrm_mailing_event_bounce.id',
101 'table_name' => 'civicrm_mailing_event_bounce',
102 'entity' => 'Bounce',
103 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
104 'localizable' => 0,
105 ],
106 'event_queue_id' => [
107 'name' => 'event_queue_id',
108 'type' => CRM_Utils_Type::T_INT,
109 'title' => ts('Event Queue'),
110 'description' => ts('FK to EventQueue'),
111 'required' => TRUE,
112 'where' => 'civicrm_mailing_event_bounce.event_queue_id',
113 'table_name' => 'civicrm_mailing_event_bounce',
114 'entity' => 'Bounce',
115 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
116 'localizable' => 0,
117 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
118 ],
119 'bounce_type_id' => [
120 'name' => 'bounce_type_id',
121 'type' => CRM_Utils_Type::T_INT,
122 'title' => ts('Bounce Type'),
123 'description' => ts('What type of bounce was it?'),
124 'where' => 'civicrm_mailing_event_bounce.bounce_type_id',
125 'table_name' => 'civicrm_mailing_event_bounce',
126 'entity' => 'Bounce',
127 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
128 'localizable' => 0,
129 'html' => [
130 'type' => 'Select',
131 ],
132 'pseudoconstant' => [
133 'table' => 'civicrm_mailing_bounce_type',
134 'keyColumn' => 'id',
135 'labelColumn' => 'name',
136 ],
137 ],
138 'bounce_reason' => [
139 'name' => 'bounce_reason',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('Bounce Reason'),
142 'description' => ts('The reason the email bounced.'),
143 'maxlength' => 255,
144 'size' => CRM_Utils_Type::HUGE,
145 'where' => 'civicrm_mailing_event_bounce.bounce_reason',
146 'table_name' => 'civicrm_mailing_event_bounce',
147 'entity' => 'Bounce',
148 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
149 'localizable' => 0,
150 ],
151 'time_stamp' => [
152 'name' => 'time_stamp',
153 'type' => CRM_Utils_Type::T_TIMESTAMP,
154 'title' => ts('Timestamp'),
155 'description' => ts('When this bounce event occurred.'),
156 'required' => TRUE,
157 'where' => 'civicrm_mailing_event_bounce.time_stamp',
158 'default' => 'CURRENT_TIMESTAMP',
159 'table_name' => 'civicrm_mailing_event_bounce',
160 'entity' => 'Bounce',
161 'bao' => 'CRM_Mailing_Event_BAO_Bounce',
162 'localizable' => 0,
163 ],
164 ];
165 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
166 }
167 return Civi::$statics[__CLASS__]['fields'];
168 }
169
170 /**
171 * Return a mapping from field-name to the corresponding key (as used in fields()).
172 *
173 * @return array
174 * Array(string $name => string $uniqueName).
175 */
176 public static function &fieldKeys() {
177 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
178 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
179 }
180 return Civi::$statics[__CLASS__]['fieldKeys'];
181 }
182
183 /**
184 * Returns the names of this table
185 *
186 * @return string
187 */
188 public static function getTableName() {
189 return self::$_tableName;
190 }
191
192 /**
193 * Returns if this table needs to be logged
194 *
195 * @return bool
196 */
197 public function getLog() {
198 return self::$_log;
199 }
200
201 /**
202 * Returns the list of fields that can be imported
203 *
204 * @param bool $prefix
205 *
206 * @return array
207 */
208 public static function &import($prefix = FALSE) {
209 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_bounce', $prefix, []);
210 return $r;
211 }
212
213 /**
214 * Returns the list of fields that can be exported
215 *
216 * @param bool $prefix
217 *
218 * @return array
219 */
220 public static function &export($prefix = FALSE) {
221 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_bounce', $prefix, []);
222 return $r;
223 }
224
225 /**
226 * Returns the list of indices
227 *
228 * @param bool $localize
229 *
230 * @return array
231 */
232 public static function indices($localize = TRUE) {
233 $indices = [];
234 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
235 }
236
237 }