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