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