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