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