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:075e135a610dcb619ab3ddc8c23944e1)
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
= '';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_mailing_abtest';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
39 * Name of the A/B test
53 * The first experimental mailing ("A" condition)
60 * The second experimental mailing ("B" condition)
67 * The final, general mailing (derived from A or B)
74 * Which site is this mailing for
83 public $testing_criteria;
88 public $winner_criteria;
91 * What specific url to track
98 * In how much time to declare winner
102 public $declare_winning_time;
107 public $group_percentage;
117 * When was this item created
121 public $created_date;
126 public function __construct() {
127 $this->__table
= 'civicrm_mailing_abtest';
128 parent
::__construct();
132 * Returns localized title of this entity.
134 * @param bool $plural
135 * Whether to return the plural version of the title.
137 public static function getEntityTitle($plural = FALSE) {
138 return $plural ?
ts('Mailing ABs') : ts('Mailing AB');
142 * Returns foreign keys and entity references.
145 * [CRM_Core_Reference_Interface]
147 public static function getReferenceColumns() {
148 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
149 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
150 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
151 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
153 return Civi
::$statics[__CLASS__
]['links'];
157 * Returns all the column names of this table
161 public static function &fields() {
162 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
163 Civi
::$statics[__CLASS__
]['fields'] = [
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('MailingAB ID'),
169 'where' => 'civicrm_mailing_abtest.id',
170 'table_name' => 'civicrm_mailing_abtest',
171 'entity' => 'MailingAB',
172 'bao' => 'CRM_Mailing_BAO_MailingAB',
178 'type' => CRM_Utils_Type
::T_STRING
,
179 'title' => ts('Name'),
180 'description' => ts('Name of the A/B test'),
182 'size' => CRM_Utils_Type
::HUGE
,
183 'where' => 'civicrm_mailing_abtest.name',
184 'table_name' => 'civicrm_mailing_abtest',
185 'entity' => 'MailingAB',
186 'bao' => 'CRM_Mailing_BAO_MailingAB',
192 'type' => CRM_Utils_Type
::T_STRING
,
193 'title' => ts('Status'),
194 'description' => ts('Status'),
196 'size' => CRM_Utils_Type
::MEDIUM
,
197 'where' => 'civicrm_mailing_abtest.status',
198 'table_name' => 'civicrm_mailing_abtest',
199 'entity' => 'MailingAB',
200 'bao' => 'CRM_Mailing_BAO_MailingAB',
202 'pseudoconstant' => [
203 'callback' => 'CRM_Mailing_PseudoConstant::abStatus',
208 'name' => 'mailing_id_a',
209 'type' => CRM_Utils_Type
::T_INT
,
210 'title' => ts('Mailing ID (A)'),
211 'description' => ts('The first experimental mailing ("A" condition)'),
212 'where' => 'civicrm_mailing_abtest.mailing_id_a',
213 'table_name' => 'civicrm_mailing_abtest',
214 'entity' => 'MailingAB',
215 'bao' => 'CRM_Mailing_BAO_MailingAB',
220 'name' => 'mailing_id_b',
221 'type' => CRM_Utils_Type
::T_INT
,
222 'title' => ts('Mailing ID (B)'),
223 'description' => ts('The second experimental mailing ("B" condition)'),
224 'where' => 'civicrm_mailing_abtest.mailing_id_b',
225 'table_name' => 'civicrm_mailing_abtest',
226 'entity' => 'MailingAB',
227 'bao' => 'CRM_Mailing_BAO_MailingAB',
232 'name' => 'mailing_id_c',
233 'type' => CRM_Utils_Type
::T_INT
,
234 'title' => ts('Mailing ID (C)'),
235 'description' => ts('The final, general mailing (derived from A or B)'),
236 'where' => 'civicrm_mailing_abtest.mailing_id_c',
237 'table_name' => 'civicrm_mailing_abtest',
238 'entity' => 'MailingAB',
239 'bao' => 'CRM_Mailing_BAO_MailingAB',
244 'name' => 'domain_id',
245 'type' => CRM_Utils_Type
::T_INT
,
246 'title' => ts('Domain ID'),
247 'description' => ts('Which site is this mailing for'),
249 'where' => 'civicrm_mailing_abtest.domain_id',
250 'table_name' => 'civicrm_mailing_abtest',
251 'entity' => 'MailingAB',
252 'bao' => 'CRM_Mailing_BAO_MailingAB',
256 'testing_criteria' => [
257 'name' => 'testing_criteria',
258 'type' => CRM_Utils_Type
::T_STRING
,
259 'title' => ts('Testing Criteria'),
261 'size' => CRM_Utils_Type
::MEDIUM
,
262 'where' => 'civicrm_mailing_abtest.testing_criteria',
263 'table_name' => 'civicrm_mailing_abtest',
264 'entity' => 'MailingAB',
265 'bao' => 'CRM_Mailing_BAO_MailingAB',
267 'pseudoconstant' => [
268 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria',
272 'winner_criteria' => [
273 'name' => 'winner_criteria',
274 'type' => CRM_Utils_Type
::T_STRING
,
275 'title' => ts('Winner Criteria'),
277 'size' => CRM_Utils_Type
::MEDIUM
,
278 'where' => 'civicrm_mailing_abtest.winner_criteria',
279 'table_name' => 'civicrm_mailing_abtest',
280 'entity' => 'MailingAB',
281 'bao' => 'CRM_Mailing_BAO_MailingAB',
283 'pseudoconstant' => [
284 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria',
289 'name' => 'specific_url',
290 'type' => CRM_Utils_Type
::T_STRING
,
291 'title' => ts('URL for Winner Criteria'),
292 'description' => ts('What specific url to track'),
294 'size' => CRM_Utils_Type
::HUGE
,
295 'where' => 'civicrm_mailing_abtest.specific_url',
296 'table_name' => 'civicrm_mailing_abtest',
297 'entity' => 'MailingAB',
298 'bao' => 'CRM_Mailing_BAO_MailingAB',
302 'declare_winning_time' => [
303 'name' => 'declare_winning_time',
304 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
305 'title' => ts('Declaration Time'),
306 'description' => ts('In how much time to declare winner'),
307 'where' => 'civicrm_mailing_abtest.declare_winning_time',
308 'table_name' => 'civicrm_mailing_abtest',
309 'entity' => 'MailingAB',
310 'bao' => 'CRM_Mailing_BAO_MailingAB',
314 'group_percentage' => [
315 'name' => 'group_percentage',
316 'type' => CRM_Utils_Type
::T_INT
,
317 'title' => ts('Group Percentage'),
318 'where' => 'civicrm_mailing_abtest.group_percentage',
319 'table_name' => 'civicrm_mailing_abtest',
320 'entity' => 'MailingAB',
321 'bao' => 'CRM_Mailing_BAO_MailingAB',
326 'name' => 'created_id',
327 'type' => CRM_Utils_Type
::T_INT
,
328 'title' => ts('AB Test Created By'),
329 'description' => ts('FK to Contact ID'),
330 'where' => 'civicrm_mailing_abtest.created_id',
331 'table_name' => 'civicrm_mailing_abtest',
332 'entity' => 'MailingAB',
333 'bao' => 'CRM_Mailing_BAO_MailingAB',
335 'FKClassName' => 'CRM_Contact_DAO_Contact',
339 'name' => 'created_date',
340 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
341 'title' => ts('AB Test Created Date'),
342 'description' => ts('When was this item created'),
344 'where' => 'civicrm_mailing_abtest.created_date',
345 'default' => 'CURRENT_TIMESTAMP',
346 'table_name' => 'civicrm_mailing_abtest',
347 'entity' => 'MailingAB',
348 'bao' => 'CRM_Mailing_BAO_MailingAB',
351 'type' => 'Select Date',
352 'formatType' => 'mailing',
357 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
359 return Civi
::$statics[__CLASS__
]['fields'];
363 * Return a mapping from field-name to the corresponding key (as used in fields()).
366 * Array(string $name => string $uniqueName).
368 public static function &fieldKeys() {
369 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
370 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
372 return Civi
::$statics[__CLASS__
]['fieldKeys'];
376 * Returns the names of this table
380 public static function getTableName() {
381 return self
::$_tableName;
385 * Returns if this table needs to be logged
389 public function getLog() {
394 * Returns the list of fields that can be imported
396 * @param bool $prefix
400 public static function &import($prefix = FALSE) {
401 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_abtest', $prefix, []);
406 * Returns the list of fields that can be exported
408 * @param bool $prefix
412 public static function &export($prefix = FALSE) {
413 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_abtest', $prefix, []);
418 * Returns the list of indices
420 * @param bool $localize
424 public static function indices($localize = TRUE) {
426 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;