5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Mailing/MailingAB.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:c385d0cae9e88e5a44770cd3ae6fd9d2)
13 * Database access object for the MailingAB entity.
15 class CRM_Mailing_DAO_MailingAB
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '';
18 const COMPONENT
= 'CiviMail';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_mailing_abtest';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
42 * Name of the A/B test
45 * (SQL type: varchar(128))
46 * Note that values will be retrieved from the database as a string.
54 * (SQL type: varchar(32))
55 * Note that values will be retrieved from the database as a string.
60 * The first experimental mailing ("A" condition)
62 * @var int|string|null
63 * (SQL type: int unsigned)
64 * Note that values will be retrieved from the database as a string.
69 * The second experimental mailing ("B" condition)
71 * @var int|string|null
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
78 * The final, general mailing (derived from A or B)
80 * @var int|string|null
81 * (SQL type: int unsigned)
82 * Note that values will be retrieved from the database as a string.
87 * Which site is this mailing for
90 * (SQL type: int unsigned)
91 * Note that values will be retrieved from the database as a string.
97 * (SQL type: varchar(32))
98 * Note that values will be retrieved from the database as a string.
100 public $testing_criteria;
104 * (SQL type: varchar(32))
105 * Note that values will be retrieved from the database as a string.
107 public $winner_criteria;
110 * What specific url to track
113 * (SQL type: varchar(255))
114 * Note that values will be retrieved from the database as a string.
116 public $specific_url;
119 * In how much time to declare winner
122 * (SQL type: datetime)
123 * Note that values will be retrieved from the database as a string.
125 public $declare_winning_time;
128 * @var int|string|null
129 * (SQL type: int unsigned)
130 * Note that values will be retrieved from the database as a string.
132 public $group_percentage;
137 * @var int|string|null
138 * (SQL type: int unsigned)
139 * Note that values will be retrieved from the database as a string.
144 * When was this item created
147 * (SQL type: timestamp)
148 * Note that values will be retrieved from the database as a string.
150 public $created_date;
155 public function __construct() {
156 $this->__table
= 'civicrm_mailing_abtest';
157 parent
::__construct();
161 * Returns localized title of this entity.
163 * @param bool $plural
164 * Whether to return the plural version of the title.
166 public static function getEntityTitle($plural = FALSE) {
167 return $plural ?
ts('Mailing ABs') : ts('Mailing AB');
171 * Returns foreign keys and entity references.
174 * [CRM_Core_Reference_Interface]
176 public static function getReferenceColumns() {
177 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
178 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
179 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
180 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
182 return Civi
::$statics[__CLASS__
]['links'];
186 * Returns all the column names of this table
190 public static function &fields() {
191 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
192 Civi
::$statics[__CLASS__
]['fields'] = [
195 'type' => CRM_Utils_Type
::T_INT
,
196 'title' => ts('MailingAB ID'),
198 'where' => 'civicrm_mailing_abtest.id',
199 'table_name' => 'civicrm_mailing_abtest',
200 'entity' => 'MailingAB',
201 'bao' => 'CRM_Mailing_BAO_MailingAB',
211 'type' => CRM_Utils_Type
::T_STRING
,
212 'title' => ts('Name'),
213 'description' => ts('Name of the A/B test'),
215 'size' => CRM_Utils_Type
::HUGE
,
216 'where' => 'civicrm_mailing_abtest.name',
217 'table_name' => 'civicrm_mailing_abtest',
218 'entity' => 'MailingAB',
219 'bao' => 'CRM_Mailing_BAO_MailingAB',
225 'type' => CRM_Utils_Type
::T_STRING
,
226 'title' => ts('Status'),
227 'description' => ts('Status'),
229 'size' => CRM_Utils_Type
::MEDIUM
,
230 'where' => 'civicrm_mailing_abtest.status',
231 'table_name' => 'civicrm_mailing_abtest',
232 'entity' => 'MailingAB',
233 'bao' => 'CRM_Mailing_BAO_MailingAB',
235 'pseudoconstant' => [
236 'callback' => 'CRM_Mailing_PseudoConstant::abStatus',
241 'name' => 'mailing_id_a',
242 'type' => CRM_Utils_Type
::T_INT
,
243 'title' => ts('Mailing ID (A)'),
244 'description' => ts('The first experimental mailing ("A" condition)'),
245 'where' => 'civicrm_mailing_abtest.mailing_id_a',
246 'table_name' => 'civicrm_mailing_abtest',
247 'entity' => 'MailingAB',
248 'bao' => 'CRM_Mailing_BAO_MailingAB',
253 'name' => 'mailing_id_b',
254 'type' => CRM_Utils_Type
::T_INT
,
255 'title' => ts('Mailing ID (B)'),
256 'description' => ts('The second experimental mailing ("B" condition)'),
257 'where' => 'civicrm_mailing_abtest.mailing_id_b',
258 'table_name' => 'civicrm_mailing_abtest',
259 'entity' => 'MailingAB',
260 'bao' => 'CRM_Mailing_BAO_MailingAB',
265 'name' => 'mailing_id_c',
266 'type' => CRM_Utils_Type
::T_INT
,
267 'title' => ts('Mailing ID (C)'),
268 'description' => ts('The final, general mailing (derived from A or B)'),
269 'where' => 'civicrm_mailing_abtest.mailing_id_c',
270 'table_name' => 'civicrm_mailing_abtest',
271 'entity' => 'MailingAB',
272 'bao' => 'CRM_Mailing_BAO_MailingAB',
277 'name' => 'domain_id',
278 'type' => CRM_Utils_Type
::T_INT
,
279 'title' => ts('Domain ID'),
280 'description' => ts('Which site is this mailing for'),
282 'where' => 'civicrm_mailing_abtest.domain_id',
283 'table_name' => 'civicrm_mailing_abtest',
284 'entity' => 'MailingAB',
285 'bao' => 'CRM_Mailing_BAO_MailingAB',
289 'testing_criteria' => [
290 'name' => 'testing_criteria',
291 'type' => CRM_Utils_Type
::T_STRING
,
292 'title' => ts('Testing Criteria'),
294 'size' => CRM_Utils_Type
::MEDIUM
,
295 'where' => 'civicrm_mailing_abtest.testing_criteria',
296 'table_name' => 'civicrm_mailing_abtest',
297 'entity' => 'MailingAB',
298 'bao' => 'CRM_Mailing_BAO_MailingAB',
300 'pseudoconstant' => [
301 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria',
305 'winner_criteria' => [
306 'name' => 'winner_criteria',
307 'type' => CRM_Utils_Type
::T_STRING
,
308 'title' => ts('Winner Criteria'),
310 'size' => CRM_Utils_Type
::MEDIUM
,
311 'where' => 'civicrm_mailing_abtest.winner_criteria',
312 'table_name' => 'civicrm_mailing_abtest',
313 'entity' => 'MailingAB',
314 'bao' => 'CRM_Mailing_BAO_MailingAB',
316 'pseudoconstant' => [
317 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria',
322 'name' => 'specific_url',
323 'type' => CRM_Utils_Type
::T_STRING
,
324 'title' => ts('URL for Winner Criteria'),
325 'description' => ts('What specific url to track'),
327 'size' => CRM_Utils_Type
::HUGE
,
328 'where' => 'civicrm_mailing_abtest.specific_url',
329 'table_name' => 'civicrm_mailing_abtest',
330 'entity' => 'MailingAB',
331 'bao' => 'CRM_Mailing_BAO_MailingAB',
335 'declare_winning_time' => [
336 'name' => 'declare_winning_time',
337 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
338 'title' => ts('Declaration Time'),
339 'description' => ts('In how much time to declare winner'),
340 'where' => 'civicrm_mailing_abtest.declare_winning_time',
341 'table_name' => 'civicrm_mailing_abtest',
342 'entity' => 'MailingAB',
343 'bao' => 'CRM_Mailing_BAO_MailingAB',
347 'group_percentage' => [
348 'name' => 'group_percentage',
349 'type' => CRM_Utils_Type
::T_INT
,
350 'title' => ts('Group Percentage'),
351 'where' => 'civicrm_mailing_abtest.group_percentage',
352 'table_name' => 'civicrm_mailing_abtest',
353 'entity' => 'MailingAB',
354 'bao' => 'CRM_Mailing_BAO_MailingAB',
359 'name' => 'created_id',
360 'type' => CRM_Utils_Type
::T_INT
,
361 'title' => ts('Created By Contact ID'),
362 'description' => ts('FK to Contact ID'),
363 'where' => 'civicrm_mailing_abtest.created_id',
364 'table_name' => 'civicrm_mailing_abtest',
365 'entity' => 'MailingAB',
366 'bao' => 'CRM_Mailing_BAO_MailingAB',
368 'FKClassName' => 'CRM_Contact_DAO_Contact',
370 'label' => ts("Created By"),
375 'name' => 'created_date',
376 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
377 'title' => ts('AB Test Created Date'),
378 'description' => ts('When was this item created'),
380 'where' => 'civicrm_mailing_abtest.created_date',
381 'default' => 'CURRENT_TIMESTAMP',
382 'table_name' => 'civicrm_mailing_abtest',
383 'entity' => 'MailingAB',
384 'bao' => 'CRM_Mailing_BAO_MailingAB',
387 'type' => 'Select Date',
388 'formatType' => 'mailing',
393 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
395 return Civi
::$statics[__CLASS__
]['fields'];
399 * Return a mapping from field-name to the corresponding key (as used in fields()).
402 * Array(string $name => string $uniqueName).
404 public static function &fieldKeys() {
405 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
406 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
408 return Civi
::$statics[__CLASS__
]['fieldKeys'];
412 * Returns the names of this table
416 public static function getTableName() {
417 return self
::$_tableName;
421 * Returns if this table needs to be logged
425 public function getLog() {
430 * Returns the list of fields that can be imported
432 * @param bool $prefix
436 public static function &import($prefix = FALSE) {
437 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_abtest', $prefix, []);
442 * Returns the list of fields that can be exported
444 * @param bool $prefix
448 public static function &export($prefix = FALSE) {
449 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_abtest', $prefix, []);
454 * Returns the list of indices
456 * @param bool $localize
460 public static function indices($localize = TRUE) {
462 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;