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:afe07cb9f1839c37e7511949fc1f0bdc)
13 * Database access object for the MailingAB entity.
15 class CRM_Mailing_DAO_MailingAB
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_mailing_abtest';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
37 * Name of the A/B test
51 * The first experimental mailing ("A" condition)
58 * The second experimental mailing ("B" condition)
65 * The final, general mailing (derived from A or B)
72 * Which site is this mailing for
81 public $testing_criteria;
86 public $winner_criteria;
89 * What specific url to track
96 * In how much time to declare winner
100 public $declare_winning_time;
105 public $group_percentage;
115 * When was this item created
119 public $created_date;
124 public function __construct() {
125 $this->__table
= 'civicrm_mailing_abtest';
126 parent
::__construct();
130 * Returns localized title of this entity.
132 public static function getEntityTitle() {
133 return ts('Mailing ABs');
137 * Returns foreign keys and entity references.
140 * [CRM_Core_Reference_Interface]
142 public static function getReferenceColumns() {
143 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
144 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
145 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
146 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
148 return Civi
::$statics[__CLASS__
]['links'];
152 * Returns all the column names of this table
156 public static function &fields() {
157 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
158 Civi
::$statics[__CLASS__
]['fields'] = [
161 'type' => CRM_Utils_Type
::T_INT
,
162 'title' => ts('MailingAB ID'),
164 'where' => 'civicrm_mailing_abtest.id',
165 'table_name' => 'civicrm_mailing_abtest',
166 'entity' => 'MailingAB',
167 'bao' => 'CRM_Mailing_BAO_MailingAB',
172 'type' => CRM_Utils_Type
::T_STRING
,
173 'title' => ts('Name'),
174 'description' => ts('Name of the A/B test'),
176 'size' => CRM_Utils_Type
::HUGE
,
177 'where' => 'civicrm_mailing_abtest.name',
178 'table_name' => 'civicrm_mailing_abtest',
179 'entity' => 'MailingAB',
180 'bao' => 'CRM_Mailing_BAO_MailingAB',
185 'type' => CRM_Utils_Type
::T_STRING
,
186 'title' => ts('Status'),
187 'description' => ts('Status'),
189 'size' => CRM_Utils_Type
::MEDIUM
,
190 'where' => 'civicrm_mailing_abtest.status',
191 'table_name' => 'civicrm_mailing_abtest',
192 'entity' => 'MailingAB',
193 'bao' => 'CRM_Mailing_BAO_MailingAB',
195 'pseudoconstant' => [
196 'callback' => 'CRM_Mailing_PseudoConstant::abStatus',
200 'name' => 'mailing_id_a',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Mailing ID (A)'),
203 'description' => ts('The first experimental mailing ("A" condition)'),
204 'where' => 'civicrm_mailing_abtest.mailing_id_a',
205 'table_name' => 'civicrm_mailing_abtest',
206 'entity' => 'MailingAB',
207 'bao' => 'CRM_Mailing_BAO_MailingAB',
211 'name' => 'mailing_id_b',
212 'type' => CRM_Utils_Type
::T_INT
,
213 'title' => ts('Mailing ID (B)'),
214 'description' => ts('The second experimental mailing ("B" condition)'),
215 'where' => 'civicrm_mailing_abtest.mailing_id_b',
216 'table_name' => 'civicrm_mailing_abtest',
217 'entity' => 'MailingAB',
218 'bao' => 'CRM_Mailing_BAO_MailingAB',
222 'name' => 'mailing_id_c',
223 'type' => CRM_Utils_Type
::T_INT
,
224 'title' => ts('Mailing ID (C)'),
225 'description' => ts('The final, general mailing (derived from A or B)'),
226 'where' => 'civicrm_mailing_abtest.mailing_id_c',
227 'table_name' => 'civicrm_mailing_abtest',
228 'entity' => 'MailingAB',
229 'bao' => 'CRM_Mailing_BAO_MailingAB',
233 'name' => 'domain_id',
234 'type' => CRM_Utils_Type
::T_INT
,
235 'title' => ts('Domain ID'),
236 'description' => ts('Which site is this mailing for'),
238 'where' => 'civicrm_mailing_abtest.domain_id',
239 'table_name' => 'civicrm_mailing_abtest',
240 'entity' => 'MailingAB',
241 'bao' => 'CRM_Mailing_BAO_MailingAB',
244 'testing_criteria' => [
245 'name' => 'testing_criteria',
246 'type' => CRM_Utils_Type
::T_STRING
,
247 'title' => ts('Testing Criteria'),
249 'size' => CRM_Utils_Type
::MEDIUM
,
250 'where' => 'civicrm_mailing_abtest.testing_criteria',
251 'table_name' => 'civicrm_mailing_abtest',
252 'entity' => 'MailingAB',
253 'bao' => 'CRM_Mailing_BAO_MailingAB',
255 'pseudoconstant' => [
256 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria',
259 'winner_criteria' => [
260 'name' => 'winner_criteria',
261 'type' => CRM_Utils_Type
::T_STRING
,
262 'title' => ts('Winner Criteria'),
264 'size' => CRM_Utils_Type
::MEDIUM
,
265 'where' => 'civicrm_mailing_abtest.winner_criteria',
266 'table_name' => 'civicrm_mailing_abtest',
267 'entity' => 'MailingAB',
268 'bao' => 'CRM_Mailing_BAO_MailingAB',
270 'pseudoconstant' => [
271 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria',
275 'name' => 'specific_url',
276 'type' => CRM_Utils_Type
::T_STRING
,
277 'title' => ts('URL for Winner Criteria'),
278 'description' => ts('What specific url to track'),
280 'size' => CRM_Utils_Type
::HUGE
,
281 'where' => 'civicrm_mailing_abtest.specific_url',
282 'table_name' => 'civicrm_mailing_abtest',
283 'entity' => 'MailingAB',
284 'bao' => 'CRM_Mailing_BAO_MailingAB',
287 'declare_winning_time' => [
288 'name' => 'declare_winning_time',
289 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
290 'title' => ts('Declaration Time'),
291 'description' => ts('In how much time to declare winner'),
292 'where' => 'civicrm_mailing_abtest.declare_winning_time',
293 'table_name' => 'civicrm_mailing_abtest',
294 'entity' => 'MailingAB',
295 'bao' => 'CRM_Mailing_BAO_MailingAB',
298 'group_percentage' => [
299 'name' => 'group_percentage',
300 'type' => CRM_Utils_Type
::T_INT
,
301 'title' => ts('Group Percentage'),
302 'where' => 'civicrm_mailing_abtest.group_percentage',
303 'table_name' => 'civicrm_mailing_abtest',
304 'entity' => 'MailingAB',
305 'bao' => 'CRM_Mailing_BAO_MailingAB',
309 'name' => 'created_id',
310 'type' => CRM_Utils_Type
::T_INT
,
311 'title' => ts('AB Test Created By'),
312 'description' => ts('FK to Contact ID'),
313 'where' => 'civicrm_mailing_abtest.created_id',
314 'table_name' => 'civicrm_mailing_abtest',
315 'entity' => 'MailingAB',
316 'bao' => 'CRM_Mailing_BAO_MailingAB',
318 'FKClassName' => 'CRM_Contact_DAO_Contact',
321 'name' => 'created_date',
322 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
323 'title' => ts('AB Test Created Date'),
324 'description' => ts('When was this item created'),
326 'where' => 'civicrm_mailing_abtest.created_date',
327 'default' => 'CURRENT_TIMESTAMP',
328 'table_name' => 'civicrm_mailing_abtest',
329 'entity' => 'MailingAB',
330 'bao' => 'CRM_Mailing_BAO_MailingAB',
333 'type' => 'Select Date',
337 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
339 return Civi
::$statics[__CLASS__
]['fields'];
343 * Return a mapping from field-name to the corresponding key (as used in fields()).
346 * Array(string $name => string $uniqueName).
348 public static function &fieldKeys() {
349 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
350 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
352 return Civi
::$statics[__CLASS__
]['fieldKeys'];
356 * Returns the names of this table
360 public static function getTableName() {
361 return self
::$_tableName;
365 * Returns if this table needs to be logged
369 public function getLog() {
374 * Returns the list of fields that can be imported
376 * @param bool $prefix
380 public static function &import($prefix = FALSE) {
381 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_abtest', $prefix, []);
386 * Returns the list of fields that can be exported
388 * @param bool $prefix
392 public static function &export($prefix = FALSE) {
393 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_abtest', $prefix, []);
398 * Returns the list of indices
400 * @param bool $localize
404 public static function indices($localize = TRUE) {
406 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;