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