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