Merge in 5.27
[civicrm-core.git] / CRM / Mailing / DAO / MailingAB.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/MailingAB.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:afe07cb9f1839c37e7511949fc1f0bdc)
10 */
11
12 /**
13 * Database access object for the MailingAB entity.
14 */
15 class CRM_Mailing_DAO_MailingAB 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_abtest';
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 * Name of the A/B test
38 *
39 * @var string
40 */
41 public $name;
42
43 /**
44 * Status
45 *
46 * @var string
47 */
48 public $status;
49
50 /**
51 * The first experimental mailing ("A" condition)
52 *
53 * @var int
54 */
55 public $mailing_id_a;
56
57 /**
58 * The second experimental mailing ("B" condition)
59 *
60 * @var int
61 */
62 public $mailing_id_b;
63
64 /**
65 * The final, general mailing (derived from A or B)
66 *
67 * @var int
68 */
69 public $mailing_id_c;
70
71 /**
72 * Which site is this mailing for
73 *
74 * @var int
75 */
76 public $domain_id;
77
78 /**
79 * @var string
80 */
81 public $testing_criteria;
82
83 /**
84 * @var string
85 */
86 public $winner_criteria;
87
88 /**
89 * What specific url to track
90 *
91 * @var string
92 */
93 public $specific_url;
94
95 /**
96 * In how much time to declare winner
97 *
98 * @var datetime
99 */
100 public $declare_winning_time;
101
102 /**
103 * @var int
104 */
105 public $group_percentage;
106
107 /**
108 * FK to Contact ID
109 *
110 * @var int
111 */
112 public $created_id;
113
114 /**
115 * When was this item created
116 *
117 * @var timestamp
118 */
119 public $created_date;
120
121 /**
122 * Class constructor.
123 */
124 public function __construct() {
125 $this->__table = 'civicrm_mailing_abtest';
126 parent::__construct();
127 }
128
129 /**
130 * Returns localized title of this entity.
131 */
132 public static function getEntityTitle() {
133 return ts('Mailing ABs');
134 }
135
136 /**
137 * Returns foreign keys and entity references.
138 *
139 * @return array
140 * [CRM_Core_Reference_Interface]
141 */
142 public static function getReferenceColumns() {
143 if (!isset(Civi::$statics[__CLASS__]['links'])) {
144 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
145 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
146 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
147 }
148 return Civi::$statics[__CLASS__]['links'];
149 }
150
151 /**
152 * Returns all the column names of this table
153 *
154 * @return array
155 */
156 public static function &fields() {
157 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
158 Civi::$statics[__CLASS__]['fields'] = [
159 'id' => [
160 'name' => 'id',
161 'type' => CRM_Utils_Type::T_INT,
162 'title' => ts('MailingAB ID'),
163 'required' => TRUE,
164 'where' => 'civicrm_mailing_abtest.id',
165 'table_name' => 'civicrm_mailing_abtest',
166 'entity' => 'MailingAB',
167 'bao' => 'CRM_Mailing_BAO_MailingAB',
168 'localizable' => 0,
169 ],
170 'name' => [
171 'name' => 'name',
172 'type' => CRM_Utils_Type::T_STRING,
173 'title' => ts('Name'),
174 'description' => ts('Name of the A/B test'),
175 'maxlength' => 128,
176 'size' => CRM_Utils_Type::HUGE,
177 'where' => 'civicrm_mailing_abtest.name',
178 'table_name' => 'civicrm_mailing_abtest',
179 'entity' => 'MailingAB',
180 'bao' => 'CRM_Mailing_BAO_MailingAB',
181 'localizable' => 0,
182 ],
183 'status' => [
184 'name' => 'status',
185 'type' => CRM_Utils_Type::T_STRING,
186 'title' => ts('Status'),
187 'description' => ts('Status'),
188 'maxlength' => 32,
189 'size' => CRM_Utils_Type::MEDIUM,
190 'where' => 'civicrm_mailing_abtest.status',
191 'table_name' => 'civicrm_mailing_abtest',
192 'entity' => 'MailingAB',
193 'bao' => 'CRM_Mailing_BAO_MailingAB',
194 'localizable' => 0,
195 'pseudoconstant' => [
196 'callback' => 'CRM_Mailing_PseudoConstant::abStatus',
197 ],
198 ],
199 'mailing_id_a' => [
200 'name' => 'mailing_id_a',
201 'type' => CRM_Utils_Type::T_INT,
202 'title' => ts('Mailing ID (A)'),
203 'description' => ts('The first experimental mailing ("A" condition)'),
204 'where' => 'civicrm_mailing_abtest.mailing_id_a',
205 'table_name' => 'civicrm_mailing_abtest',
206 'entity' => 'MailingAB',
207 'bao' => 'CRM_Mailing_BAO_MailingAB',
208 'localizable' => 0,
209 ],
210 'mailing_id_b' => [
211 'name' => 'mailing_id_b',
212 'type' => CRM_Utils_Type::T_INT,
213 'title' => ts('Mailing ID (B)'),
214 'description' => ts('The second experimental mailing ("B" condition)'),
215 'where' => 'civicrm_mailing_abtest.mailing_id_b',
216 'table_name' => 'civicrm_mailing_abtest',
217 'entity' => 'MailingAB',
218 'bao' => 'CRM_Mailing_BAO_MailingAB',
219 'localizable' => 0,
220 ],
221 'mailing_id_c' => [
222 'name' => 'mailing_id_c',
223 'type' => CRM_Utils_Type::T_INT,
224 'title' => ts('Mailing ID (C)'),
225 'description' => ts('The final, general mailing (derived from A or B)'),
226 'where' => 'civicrm_mailing_abtest.mailing_id_c',
227 'table_name' => 'civicrm_mailing_abtest',
228 'entity' => 'MailingAB',
229 'bao' => 'CRM_Mailing_BAO_MailingAB',
230 'localizable' => 0,
231 ],
232 'domain_id' => [
233 'name' => 'domain_id',
234 'type' => CRM_Utils_Type::T_INT,
235 'title' => ts('Domain ID'),
236 'description' => ts('Which site is this mailing for'),
237 'required' => TRUE,
238 'where' => 'civicrm_mailing_abtest.domain_id',
239 'table_name' => 'civicrm_mailing_abtest',
240 'entity' => 'MailingAB',
241 'bao' => 'CRM_Mailing_BAO_MailingAB',
242 'localizable' => 0,
243 ],
244 'testing_criteria' => [
245 'name' => 'testing_criteria',
246 'type' => CRM_Utils_Type::T_STRING,
247 'title' => ts('Testing Criteria'),
248 'maxlength' => 32,
249 'size' => CRM_Utils_Type::MEDIUM,
250 'where' => 'civicrm_mailing_abtest.testing_criteria',
251 'table_name' => 'civicrm_mailing_abtest',
252 'entity' => 'MailingAB',
253 'bao' => 'CRM_Mailing_BAO_MailingAB',
254 'localizable' => 0,
255 'pseudoconstant' => [
256 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria',
257 ],
258 ],
259 'winner_criteria' => [
260 'name' => 'winner_criteria',
261 'type' => CRM_Utils_Type::T_STRING,
262 'title' => ts('Winner Criteria'),
263 'maxlength' => 32,
264 'size' => CRM_Utils_Type::MEDIUM,
265 'where' => 'civicrm_mailing_abtest.winner_criteria',
266 'table_name' => 'civicrm_mailing_abtest',
267 'entity' => 'MailingAB',
268 'bao' => 'CRM_Mailing_BAO_MailingAB',
269 'localizable' => 0,
270 'pseudoconstant' => [
271 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria',
272 ],
273 ],
274 'specific_url' => [
275 'name' => 'specific_url',
276 'type' => CRM_Utils_Type::T_STRING,
277 'title' => ts('URL for Winner Criteria'),
278 'description' => ts('What specific url to track'),
279 'maxlength' => 255,
280 'size' => CRM_Utils_Type::HUGE,
281 'where' => 'civicrm_mailing_abtest.specific_url',
282 'table_name' => 'civicrm_mailing_abtest',
283 'entity' => 'MailingAB',
284 'bao' => 'CRM_Mailing_BAO_MailingAB',
285 'localizable' => 0,
286 ],
287 'declare_winning_time' => [
288 'name' => 'declare_winning_time',
289 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
290 'title' => ts('Declaration Time'),
291 'description' => ts('In how much time to declare winner'),
292 'where' => 'civicrm_mailing_abtest.declare_winning_time',
293 'table_name' => 'civicrm_mailing_abtest',
294 'entity' => 'MailingAB',
295 'bao' => 'CRM_Mailing_BAO_MailingAB',
296 'localizable' => 0,
297 ],
298 'group_percentage' => [
299 'name' => 'group_percentage',
300 'type' => CRM_Utils_Type::T_INT,
301 'title' => ts('Group Percentage'),
302 'where' => 'civicrm_mailing_abtest.group_percentage',
303 'table_name' => 'civicrm_mailing_abtest',
304 'entity' => 'MailingAB',
305 'bao' => 'CRM_Mailing_BAO_MailingAB',
306 'localizable' => 0,
307 ],
308 'created_id' => [
309 'name' => 'created_id',
310 'type' => CRM_Utils_Type::T_INT,
311 'title' => ts('AB Test Created By'),
312 'description' => ts('FK to Contact ID'),
313 'where' => 'civicrm_mailing_abtest.created_id',
314 'table_name' => 'civicrm_mailing_abtest',
315 'entity' => 'MailingAB',
316 'bao' => 'CRM_Mailing_BAO_MailingAB',
317 'localizable' => 0,
318 'FKClassName' => 'CRM_Contact_DAO_Contact',
319 ],
320 'created_date' => [
321 'name' => 'created_date',
322 'type' => CRM_Utils_Type::T_TIMESTAMP,
323 'title' => ts('AB Test Created Date'),
324 'description' => ts('When was this item created'),
325 'required' => FALSE,
326 'where' => 'civicrm_mailing_abtest.created_date',
327 'default' => 'CURRENT_TIMESTAMP',
328 'table_name' => 'civicrm_mailing_abtest',
329 'entity' => 'MailingAB',
330 'bao' => 'CRM_Mailing_BAO_MailingAB',
331 'localizable' => 0,
332 'html' => [
333 'type' => 'Select Date',
334 ],
335 ],
336 ];
337 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
338 }
339 return Civi::$statics[__CLASS__]['fields'];
340 }
341
342 /**
343 * Return a mapping from field-name to the corresponding key (as used in fields()).
344 *
345 * @return array
346 * Array(string $name => string $uniqueName).
347 */
348 public static function &fieldKeys() {
349 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
350 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
351 }
352 return Civi::$statics[__CLASS__]['fieldKeys'];
353 }
354
355 /**
356 * Returns the names of this table
357 *
358 * @return string
359 */
360 public static function getTableName() {
361 return self::$_tableName;
362 }
363
364 /**
365 * Returns if this table needs to be logged
366 *
367 * @return bool
368 */
369 public function getLog() {
370 return self::$_log;
371 }
372
373 /**
374 * Returns the list of fields that can be imported
375 *
376 * @param bool $prefix
377 *
378 * @return array
379 */
380 public static function &import($prefix = FALSE) {
381 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_abtest', $prefix, []);
382 return $r;
383 }
384
385 /**
386 * Returns the list of fields that can be exported
387 *
388 * @param bool $prefix
389 *
390 * @return array
391 */
392 public static function &export($prefix = FALSE) {
393 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_abtest', $prefix, []);
394 return $r;
395 }
396
397 /**
398 * Returns the list of indices
399 *
400 * @param bool $localize
401 *
402 * @return array
403 */
404 public static function indices($localize = TRUE) {
405 $indices = [];
406 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
407 }
408
409 }