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