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:af0f7d34ddde7f3971aaac5abccfcd8c)
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 public static function getEntityTitle() {
135 return ts('Mailing ABs');
139 * Returns foreign keys and entity references.
142 * [CRM_Core_Reference_Interface]
144 public static function getReferenceColumns() {
145 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
146 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
147 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
148 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
150 return Civi
::$statics[__CLASS__
]['links'];
154 * Returns all the column names of this table
158 public static function &fields() {
159 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
160 Civi
::$statics[__CLASS__
]['fields'] = [
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('MailingAB ID'),
166 'where' => 'civicrm_mailing_abtest.id',
167 'table_name' => 'civicrm_mailing_abtest',
168 'entity' => 'MailingAB',
169 'bao' => 'CRM_Mailing_BAO_MailingAB',
175 'type' => CRM_Utils_Type
::T_STRING
,
176 'title' => ts('Name'),
177 'description' => ts('Name of the A/B test'),
179 'size' => CRM_Utils_Type
::HUGE
,
180 'where' => 'civicrm_mailing_abtest.name',
181 'table_name' => 'civicrm_mailing_abtest',
182 'entity' => 'MailingAB',
183 'bao' => 'CRM_Mailing_BAO_MailingAB',
189 'type' => CRM_Utils_Type
::T_STRING
,
190 'title' => ts('Status'),
191 'description' => ts('Status'),
193 'size' => CRM_Utils_Type
::MEDIUM
,
194 'where' => 'civicrm_mailing_abtest.status',
195 'table_name' => 'civicrm_mailing_abtest',
196 'entity' => 'MailingAB',
197 'bao' => 'CRM_Mailing_BAO_MailingAB',
199 'pseudoconstant' => [
200 'callback' => 'CRM_Mailing_PseudoConstant::abStatus',
205 'name' => 'mailing_id_a',
206 'type' => CRM_Utils_Type
::T_INT
,
207 'title' => ts('Mailing ID (A)'),
208 'description' => ts('The first experimental mailing ("A" condition)'),
209 'where' => 'civicrm_mailing_abtest.mailing_id_a',
210 'table_name' => 'civicrm_mailing_abtest',
211 'entity' => 'MailingAB',
212 'bao' => 'CRM_Mailing_BAO_MailingAB',
217 'name' => 'mailing_id_b',
218 'type' => CRM_Utils_Type
::T_INT
,
219 'title' => ts('Mailing ID (B)'),
220 'description' => ts('The second experimental mailing ("B" condition)'),
221 'where' => 'civicrm_mailing_abtest.mailing_id_b',
222 'table_name' => 'civicrm_mailing_abtest',
223 'entity' => 'MailingAB',
224 'bao' => 'CRM_Mailing_BAO_MailingAB',
229 'name' => 'mailing_id_c',
230 'type' => CRM_Utils_Type
::T_INT
,
231 'title' => ts('Mailing ID (C)'),
232 'description' => ts('The final, general mailing (derived from A or B)'),
233 'where' => 'civicrm_mailing_abtest.mailing_id_c',
234 'table_name' => 'civicrm_mailing_abtest',
235 'entity' => 'MailingAB',
236 'bao' => 'CRM_Mailing_BAO_MailingAB',
241 'name' => 'domain_id',
242 'type' => CRM_Utils_Type
::T_INT
,
243 'title' => ts('Domain ID'),
244 'description' => ts('Which site is this mailing for'),
246 'where' => 'civicrm_mailing_abtest.domain_id',
247 'table_name' => 'civicrm_mailing_abtest',
248 'entity' => 'MailingAB',
249 'bao' => 'CRM_Mailing_BAO_MailingAB',
253 'testing_criteria' => [
254 'name' => 'testing_criteria',
255 'type' => CRM_Utils_Type
::T_STRING
,
256 'title' => ts('Testing Criteria'),
258 'size' => CRM_Utils_Type
::MEDIUM
,
259 'where' => 'civicrm_mailing_abtest.testing_criteria',
260 'table_name' => 'civicrm_mailing_abtest',
261 'entity' => 'MailingAB',
262 'bao' => 'CRM_Mailing_BAO_MailingAB',
264 'pseudoconstant' => [
265 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria',
269 'winner_criteria' => [
270 'name' => 'winner_criteria',
271 'type' => CRM_Utils_Type
::T_STRING
,
272 'title' => ts('Winner Criteria'),
274 'size' => CRM_Utils_Type
::MEDIUM
,
275 'where' => 'civicrm_mailing_abtest.winner_criteria',
276 'table_name' => 'civicrm_mailing_abtest',
277 'entity' => 'MailingAB',
278 'bao' => 'CRM_Mailing_BAO_MailingAB',
280 'pseudoconstant' => [
281 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria',
286 'name' => 'specific_url',
287 'type' => CRM_Utils_Type
::T_STRING
,
288 'title' => ts('URL for Winner Criteria'),
289 'description' => ts('What specific url to track'),
291 'size' => CRM_Utils_Type
::HUGE
,
292 'where' => 'civicrm_mailing_abtest.specific_url',
293 'table_name' => 'civicrm_mailing_abtest',
294 'entity' => 'MailingAB',
295 'bao' => 'CRM_Mailing_BAO_MailingAB',
299 'declare_winning_time' => [
300 'name' => 'declare_winning_time',
301 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
302 'title' => ts('Declaration Time'),
303 'description' => ts('In how much time to declare winner'),
304 'where' => 'civicrm_mailing_abtest.declare_winning_time',
305 'table_name' => 'civicrm_mailing_abtest',
306 'entity' => 'MailingAB',
307 'bao' => 'CRM_Mailing_BAO_MailingAB',
311 'group_percentage' => [
312 'name' => 'group_percentage',
313 'type' => CRM_Utils_Type
::T_INT
,
314 'title' => ts('Group Percentage'),
315 'where' => 'civicrm_mailing_abtest.group_percentage',
316 'table_name' => 'civicrm_mailing_abtest',
317 'entity' => 'MailingAB',
318 'bao' => 'CRM_Mailing_BAO_MailingAB',
323 'name' => 'created_id',
324 'type' => CRM_Utils_Type
::T_INT
,
325 'title' => ts('AB Test Created By'),
326 'description' => ts('FK to Contact ID'),
327 'where' => 'civicrm_mailing_abtest.created_id',
328 'table_name' => 'civicrm_mailing_abtest',
329 'entity' => 'MailingAB',
330 'bao' => 'CRM_Mailing_BAO_MailingAB',
332 'FKClassName' => 'CRM_Contact_DAO_Contact',
336 'name' => 'created_date',
337 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
338 'title' => ts('AB Test Created Date'),
339 'description' => ts('When was this item created'),
341 'where' => 'civicrm_mailing_abtest.created_date',
342 'default' => 'CURRENT_TIMESTAMP',
343 'table_name' => 'civicrm_mailing_abtest',
344 'entity' => 'MailingAB',
345 'bao' => 'CRM_Mailing_BAO_MailingAB',
348 'type' => 'Select Date',
349 'formatType' => 'mailing',
354 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
356 return Civi
::$statics[__CLASS__
]['fields'];
360 * Return a mapping from field-name to the corresponding key (as used in fields()).
363 * Array(string $name => string $uniqueName).
365 public static function &fieldKeys() {
366 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
367 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
369 return Civi
::$statics[__CLASS__
]['fieldKeys'];
373 * Returns the names of this table
377 public static function getTableName() {
378 return self
::$_tableName;
382 * Returns if this table needs to be logged
386 public function getLog() {
391 * Returns the list of fields that can be imported
393 * @param bool $prefix
397 public static function &import($prefix = FALSE) {
398 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_abtest', $prefix, []);
403 * Returns the list of fields that can be exported
405 * @param bool $prefix
409 public static function &export($prefix = FALSE) {
410 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_abtest', $prefix, []);
415 * Returns the list of indices
417 * @param bool $localize
421 public static function indices($localize = TRUE) {
423 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;