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