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