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