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