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