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