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:175573c32fef00a9a00350db020b1696)
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;
40 * Name of the A/B test
54 * The first experimental mailing ("A" condition)
61 * The second experimental mailing ("B" condition)
68 * The final, general mailing (derived from A or B)
75 * Which site is this mailing for
84 public $testing_criteria;
89 public $winner_criteria;
92 * What specific url to track
99 * In how much time to declare winner
103 public $declare_winning_time;
108 public $group_percentage;
118 * When was this item created
122 public $created_date;
127 public function __construct() {
128 $this->__table
= 'civicrm_mailing_abtest';
129 parent
::__construct();
133 * Returns localized title of this entity.
135 * @param bool $plural
136 * Whether to return the plural version of the title.
138 public static function getEntityTitle($plural = FALSE) {
139 return $plural ?
ts('Mailing ABs') : ts('Mailing AB');
143 * Returns foreign keys and entity references.
146 * [CRM_Core_Reference_Interface]
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']);
154 return Civi
::$statics[__CLASS__
]['links'];
158 * Returns all the column names of this table
162 public static function &fields() {
163 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
164 Civi
::$statics[__CLASS__
]['fields'] = [
167 'type' => CRM_Utils_Type
::T_INT
,
168 'title' => ts('MailingAB ID'),
170 'where' => 'civicrm_mailing_abtest.id',
171 'table_name' => 'civicrm_mailing_abtest',
172 'entity' => 'MailingAB',
173 'bao' => 'CRM_Mailing_BAO_MailingAB',
179 'type' => CRM_Utils_Type
::T_STRING
,
180 'title' => ts('Name'),
181 'description' => ts('Name of the A/B test'),
183 'size' => CRM_Utils_Type
::HUGE
,
184 'where' => 'civicrm_mailing_abtest.name',
185 'table_name' => 'civicrm_mailing_abtest',
186 'entity' => 'MailingAB',
187 'bao' => 'CRM_Mailing_BAO_MailingAB',
193 'type' => CRM_Utils_Type
::T_STRING
,
194 'title' => ts('Status'),
195 'description' => ts('Status'),
197 'size' => CRM_Utils_Type
::MEDIUM
,
198 'where' => 'civicrm_mailing_abtest.status',
199 'table_name' => 'civicrm_mailing_abtest',
200 'entity' => 'MailingAB',
201 'bao' => 'CRM_Mailing_BAO_MailingAB',
203 'pseudoconstant' => [
204 'callback' => 'CRM_Mailing_PseudoConstant::abStatus',
209 'name' => 'mailing_id_a',
210 'type' => CRM_Utils_Type
::T_INT
,
211 'title' => ts('Mailing ID (A)'),
212 'description' => ts('The first experimental mailing ("A" condition)'),
213 'where' => 'civicrm_mailing_abtest.mailing_id_a',
214 'table_name' => 'civicrm_mailing_abtest',
215 'entity' => 'MailingAB',
216 'bao' => 'CRM_Mailing_BAO_MailingAB',
221 'name' => 'mailing_id_b',
222 'type' => CRM_Utils_Type
::T_INT
,
223 'title' => ts('Mailing ID (B)'),
224 'description' => ts('The second experimental mailing ("B" condition)'),
225 'where' => 'civicrm_mailing_abtest.mailing_id_b',
226 'table_name' => 'civicrm_mailing_abtest',
227 'entity' => 'MailingAB',
228 'bao' => 'CRM_Mailing_BAO_MailingAB',
233 'name' => 'mailing_id_c',
234 'type' => CRM_Utils_Type
::T_INT
,
235 'title' => ts('Mailing ID (C)'),
236 'description' => ts('The final, general mailing (derived from A or B)'),
237 'where' => 'civicrm_mailing_abtest.mailing_id_c',
238 'table_name' => 'civicrm_mailing_abtest',
239 'entity' => 'MailingAB',
240 'bao' => 'CRM_Mailing_BAO_MailingAB',
245 'name' => 'domain_id',
246 'type' => CRM_Utils_Type
::T_INT
,
247 'title' => ts('Domain ID'),
248 'description' => ts('Which site is this mailing for'),
250 'where' => 'civicrm_mailing_abtest.domain_id',
251 'table_name' => 'civicrm_mailing_abtest',
252 'entity' => 'MailingAB',
253 'bao' => 'CRM_Mailing_BAO_MailingAB',
257 'testing_criteria' => [
258 'name' => 'testing_criteria',
259 'type' => CRM_Utils_Type
::T_STRING
,
260 'title' => ts('Testing Criteria'),
262 'size' => CRM_Utils_Type
::MEDIUM
,
263 'where' => 'civicrm_mailing_abtest.testing_criteria',
264 'table_name' => 'civicrm_mailing_abtest',
265 'entity' => 'MailingAB',
266 'bao' => 'CRM_Mailing_BAO_MailingAB',
268 'pseudoconstant' => [
269 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria',
273 'winner_criteria' => [
274 'name' => 'winner_criteria',
275 'type' => CRM_Utils_Type
::T_STRING
,
276 'title' => ts('Winner Criteria'),
278 'size' => CRM_Utils_Type
::MEDIUM
,
279 'where' => 'civicrm_mailing_abtest.winner_criteria',
280 'table_name' => 'civicrm_mailing_abtest',
281 'entity' => 'MailingAB',
282 'bao' => 'CRM_Mailing_BAO_MailingAB',
284 'pseudoconstant' => [
285 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria',
290 'name' => 'specific_url',
291 'type' => CRM_Utils_Type
::T_STRING
,
292 'title' => ts('URL for Winner Criteria'),
293 'description' => ts('What specific url to track'),
295 'size' => CRM_Utils_Type
::HUGE
,
296 'where' => 'civicrm_mailing_abtest.specific_url',
297 'table_name' => 'civicrm_mailing_abtest',
298 'entity' => 'MailingAB',
299 'bao' => 'CRM_Mailing_BAO_MailingAB',
303 'declare_winning_time' => [
304 'name' => 'declare_winning_time',
305 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
306 'title' => ts('Declaration Time'),
307 'description' => ts('In how much time to declare winner'),
308 'where' => 'civicrm_mailing_abtest.declare_winning_time',
309 'table_name' => 'civicrm_mailing_abtest',
310 'entity' => 'MailingAB',
311 'bao' => 'CRM_Mailing_BAO_MailingAB',
315 'group_percentage' => [
316 'name' => 'group_percentage',
317 'type' => CRM_Utils_Type
::T_INT
,
318 'title' => ts('Group Percentage'),
319 'where' => 'civicrm_mailing_abtest.group_percentage',
320 'table_name' => 'civicrm_mailing_abtest',
321 'entity' => 'MailingAB',
322 'bao' => 'CRM_Mailing_BAO_MailingAB',
327 'name' => 'created_id',
328 'type' => CRM_Utils_Type
::T_INT
,
329 'title' => ts('AB Test Created By'),
330 'description' => ts('FK to Contact ID'),
331 'where' => 'civicrm_mailing_abtest.created_id',
332 'table_name' => 'civicrm_mailing_abtest',
333 'entity' => 'MailingAB',
334 'bao' => 'CRM_Mailing_BAO_MailingAB',
336 'FKClassName' => 'CRM_Contact_DAO_Contact',
340 'name' => 'created_date',
341 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
342 'title' => ts('AB Test Created Date'),
343 'description' => ts('When was this item created'),
345 'where' => 'civicrm_mailing_abtest.created_date',
346 'default' => 'CURRENT_TIMESTAMP',
347 'table_name' => 'civicrm_mailing_abtest',
348 'entity' => 'MailingAB',
349 'bao' => 'CRM_Mailing_BAO_MailingAB',
352 'type' => 'Select Date',
353 'formatType' => 'mailing',
358 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
360 return Civi
::$statics[__CLASS__
]['fields'];
364 * Return a mapping from field-name to the corresponding key (as used in fields()).
367 * Array(string $name => string $uniqueName).
369 public static function &fieldKeys() {
370 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
371 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
373 return Civi
::$statics[__CLASS__
]['fieldKeys'];
377 * Returns the names of this table
381 public static function getTableName() {
382 return self
::$_tableName;
386 * Returns if this table needs to be logged
390 public function getLog() {
395 * Returns the list of fields that can be imported
397 * @param bool $prefix
401 public static function &import($prefix = FALSE) {
402 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_abtest', $prefix, []);
407 * Returns the list of fields that can be exported
409 * @param bool $prefix
413 public static function &export($prefix = FALSE) {
414 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_abtest', $prefix, []);
419 * Returns the list of indices
421 * @param bool $localize
425 public static function indices($localize = TRUE) {
427 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;