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