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