Merge pull request #9471 from adixon/CRM-19697
[civicrm-core.git] / CRM / Mailing / DAO / MailingAB.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
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
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Mailing/MailingAB.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
6c2b97b7 33 * (GenCodeChecksum:12d9514d27712e3d9ad545ca6c2bfe91)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Mailing_DAO_MailingAB constructor.
39 */
e501603b
TO
40class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_mailing_abtest';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
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 *
6c2b97b7 130 * @var timestamp
e501603b
TO
131 */
132 public $created_date;
133 /**
f41f0342 134 * Class constructor.
e501603b
TO
135 */
136 function __construct() {
137 $this->__table = 'civicrm_mailing_abtest';
138 parent::__construct();
139 }
140 /**
f41f0342 141 * Returns foreign keys and entity references.
e501603b
TO
142 *
143 * @return array
144 * [CRM_Core_Reference_Interface]
145 */
146 static function getReferenceColumns() {
346aaaba
TO
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']);
e501603b 151 }
346aaaba 152 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
153 }
154 /**
155 * Returns all the column names of this table
156 *
157 * @return array
158 */
159 static function &fields() {
346aaaba
TO
160 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
161 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
162 'id' => array(
163 'name' => 'id',
164 'type' => CRM_Utils_Type::T_INT,
165 'title' => ts('MailingAB ID') ,
166 'required' => true,
522a26c9 167 'table_name' => 'civicrm_mailing_abtest',
168 'entity' => 'MailingAB',
169 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 170 'localizable' => 0,
e501603b
TO
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,
522a26c9 179 'table_name' => 'civicrm_mailing_abtest',
180 'entity' => 'MailingAB',
181 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 182 'localizable' => 0,
e501603b
TO
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,
522a26c9 191 'table_name' => 'civicrm_mailing_abtest',
192 'entity' => 'MailingAB',
193 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 194 'localizable' => 0,
e501603b
TO
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)',
522a26c9 204 'table_name' => 'civicrm_mailing_abtest',
205 'entity' => 'MailingAB',
206 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 207 'localizable' => 0,
e501603b
TO
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)',
522a26c9 214 'table_name' => 'civicrm_mailing_abtest',
215 'entity' => 'MailingAB',
216 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 217 'localizable' => 0,
e501603b
TO
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)',
522a26c9 224 'table_name' => 'civicrm_mailing_abtest',
225 'entity' => 'MailingAB',
226 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 227 'localizable' => 0,
e501603b
TO
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',
522a26c9 234 'table_name' => 'civicrm_mailing_abtest',
235 'entity' => 'MailingAB',
236 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 237 'localizable' => 0,
e501603b
TO
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,
522a26c9 245 'table_name' => 'civicrm_mailing_abtest',
246 'entity' => 'MailingAB',
247 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 248 'localizable' => 0,
e501603b
TO
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,
522a26c9 259 'table_name' => 'civicrm_mailing_abtest',
260 'entity' => 'MailingAB',
261 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 262 'localizable' => 0,
e501603b
TO
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,
522a26c9 274 'table_name' => 'civicrm_mailing_abtest',
275 'entity' => 'MailingAB',
276 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 277 'localizable' => 0,
e501603b
TO
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',
522a26c9 284 'table_name' => 'civicrm_mailing_abtest',
285 'entity' => 'MailingAB',
286 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 287 'localizable' => 0,
e501603b
TO
288 ) ,
289 'group_percentage' => array(
290 'name' => 'group_percentage',
291 'type' => CRM_Utils_Type::T_INT,
292 'title' => ts('Group Percentage') ,
522a26c9 293 'table_name' => 'civicrm_mailing_abtest',
294 'entity' => 'MailingAB',
295 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 296 'localizable' => 0,
e501603b
TO
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',
522a26c9 303 'table_name' => 'civicrm_mailing_abtest',
304 'entity' => 'MailingAB',
305 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 306 'localizable' => 0,
e501603b
TO
307 'FKClassName' => 'CRM_Contact_DAO_Contact',
308 ) ,
309 'created_date' => array(
310 'name' => 'created_date',
6c2b97b7 311 'type' => CRM_Utils_Type::T_TIMESTAMP,
e501603b
TO
312 'title' => ts('AB Test Created Date') ,
313 'description' => 'When was this item created',
6c2b97b7 314 'required' => false,
315 'default' => 'CURRENT_TIMESTAMP',
522a26c9 316 'table_name' => 'civicrm_mailing_abtest',
317 'entity' => 'MailingAB',
318 'bao' => 'CRM_Mailing_BAO_MailingAB',
6a7e5e5d 319 'localizable' => 0,
e501603b
TO
320 'html' => array(
321 'type' => 'Select Date',
322 ) ,
323 ) ,
324 );
346aaaba 325 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 326 }
346aaaba 327 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
328 }
329 /**
bd8e0b14 330 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
331 *
332 * @return array
bd8e0b14 333 * Array(string $name => string $uniqueName).
e501603b
TO
334 */
335 static function &fieldKeys() {
bd8e0b14
TO
336 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
337 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 338 }
bd8e0b14 339 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
340 }
341 /**
342 * Returns the names of this table
343 *
344 * @return string
345 */
346 static function getTableName() {
347 return self::$_tableName;
348 }
349 /**
350 * Returns if this table needs to be logged
351 *
352 * @return boolean
353 */
354 function getLog() {
355 return self::$_log;
356 }
357 /**
358 * Returns the list of fields that can be imported
359 *
360 * @param bool $prefix
361 *
362 * @return array
363 */
364 static function &import($prefix = false) {
60808919
TO
365 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_abtest', $prefix, array());
366 return $r;
e501603b
TO
367 }
368 /**
369 * Returns the list of fields that can be exported
370 *
371 * @param bool $prefix
372 *
373 * @return array
374 */
375 static function &export($prefix = false) {
60808919
TO
376 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_abtest', $prefix, array());
377 return $r;
e501603b 378 }
e7a6b91a
AS
379 /**
380 * Returns the list of indices
381 */
382 public static function indices($localize = TRUE) {
383 $indices = array();
384 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
385 }
e501603b 386}