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