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