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:021242562cab688e65a6c13247c61636)
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',
183 'type' => CRM_Utils_Type
::T_STRING
,
184 'title' => ts('Name'),
185 'description' => ts('Name of the A/B test'),
187 'size' => CRM_Utils_Type
::HUGE
,
188 'where' => 'civicrm_mailing_abtest.name',
189 'table_name' => 'civicrm_mailing_abtest',
190 'entity' => 'MailingAB',
191 'bao' => 'CRM_Mailing_BAO_MailingAB',
197 'type' => CRM_Utils_Type
::T_STRING
,
198 'title' => ts('Status'),
199 'description' => ts('Status'),
201 'size' => CRM_Utils_Type
::MEDIUM
,
202 'where' => 'civicrm_mailing_abtest.status',
203 'table_name' => 'civicrm_mailing_abtest',
204 'entity' => 'MailingAB',
205 'bao' => 'CRM_Mailing_BAO_MailingAB',
207 'pseudoconstant' => [
208 'callback' => 'CRM_Mailing_PseudoConstant::abStatus',
213 'name' => 'mailing_id_a',
214 'type' => CRM_Utils_Type
::T_INT
,
215 'title' => ts('Mailing ID (A)'),
216 'description' => ts('The first experimental mailing ("A" condition)'),
217 'where' => 'civicrm_mailing_abtest.mailing_id_a',
218 'table_name' => 'civicrm_mailing_abtest',
219 'entity' => 'MailingAB',
220 'bao' => 'CRM_Mailing_BAO_MailingAB',
225 'name' => 'mailing_id_b',
226 'type' => CRM_Utils_Type
::T_INT
,
227 'title' => ts('Mailing ID (B)'),
228 'description' => ts('The second experimental mailing ("B" condition)'),
229 'where' => 'civicrm_mailing_abtest.mailing_id_b',
230 'table_name' => 'civicrm_mailing_abtest',
231 'entity' => 'MailingAB',
232 'bao' => 'CRM_Mailing_BAO_MailingAB',
237 'name' => 'mailing_id_c',
238 'type' => CRM_Utils_Type
::T_INT
,
239 'title' => ts('Mailing ID (C)'),
240 'description' => ts('The final, general mailing (derived from A or B)'),
241 'where' => 'civicrm_mailing_abtest.mailing_id_c',
242 'table_name' => 'civicrm_mailing_abtest',
243 'entity' => 'MailingAB',
244 'bao' => 'CRM_Mailing_BAO_MailingAB',
249 'name' => 'domain_id',
250 'type' => CRM_Utils_Type
::T_INT
,
251 'title' => ts('Domain ID'),
252 'description' => ts('Which site is this mailing for'),
254 'where' => 'civicrm_mailing_abtest.domain_id',
255 'table_name' => 'civicrm_mailing_abtest',
256 'entity' => 'MailingAB',
257 'bao' => 'CRM_Mailing_BAO_MailingAB',
261 'testing_criteria' => [
262 'name' => 'testing_criteria',
263 'type' => CRM_Utils_Type
::T_STRING
,
264 'title' => ts('Testing Criteria'),
266 'size' => CRM_Utils_Type
::MEDIUM
,
267 'where' => 'civicrm_mailing_abtest.testing_criteria',
268 'table_name' => 'civicrm_mailing_abtest',
269 'entity' => 'MailingAB',
270 'bao' => 'CRM_Mailing_BAO_MailingAB',
272 'pseudoconstant' => [
273 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria',
277 'winner_criteria' => [
278 'name' => 'winner_criteria',
279 'type' => CRM_Utils_Type
::T_STRING
,
280 'title' => ts('Winner Criteria'),
282 'size' => CRM_Utils_Type
::MEDIUM
,
283 'where' => 'civicrm_mailing_abtest.winner_criteria',
284 'table_name' => 'civicrm_mailing_abtest',
285 'entity' => 'MailingAB',
286 'bao' => 'CRM_Mailing_BAO_MailingAB',
288 'pseudoconstant' => [
289 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria',
294 'name' => 'specific_url',
295 'type' => CRM_Utils_Type
::T_STRING
,
296 'title' => ts('URL for Winner Criteria'),
297 'description' => ts('What specific url to track'),
299 'size' => CRM_Utils_Type
::HUGE
,
300 'where' => 'civicrm_mailing_abtest.specific_url',
301 'table_name' => 'civicrm_mailing_abtest',
302 'entity' => 'MailingAB',
303 'bao' => 'CRM_Mailing_BAO_MailingAB',
307 'declare_winning_time' => [
308 'name' => 'declare_winning_time',
309 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
310 'title' => ts('Declaration Time'),
311 'description' => ts('In how much time to declare winner'),
312 'where' => 'civicrm_mailing_abtest.declare_winning_time',
313 'table_name' => 'civicrm_mailing_abtest',
314 'entity' => 'MailingAB',
315 'bao' => 'CRM_Mailing_BAO_MailingAB',
319 'group_percentage' => [
320 'name' => 'group_percentage',
321 'type' => CRM_Utils_Type
::T_INT
,
322 'title' => ts('Group Percentage'),
323 'where' => 'civicrm_mailing_abtest.group_percentage',
324 'table_name' => 'civicrm_mailing_abtest',
325 'entity' => 'MailingAB',
326 'bao' => 'CRM_Mailing_BAO_MailingAB',
331 'name' => 'created_id',
332 'type' => CRM_Utils_Type
::T_INT
,
333 'title' => ts('Created By Contact ID'),
334 'description' => ts('FK to Contact ID'),
335 'where' => 'civicrm_mailing_abtest.created_id',
336 'table_name' => 'civicrm_mailing_abtest',
337 'entity' => 'MailingAB',
338 'bao' => 'CRM_Mailing_BAO_MailingAB',
340 'FKClassName' => 'CRM_Contact_DAO_Contact',
342 'label' => ts("Created By"),
347 'name' => 'created_date',
348 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
349 'title' => ts('AB Test Created Date'),
350 'description' => ts('When was this item created'),
352 'where' => 'civicrm_mailing_abtest.created_date',
353 'default' => 'CURRENT_TIMESTAMP',
354 'table_name' => 'civicrm_mailing_abtest',
355 'entity' => 'MailingAB',
356 'bao' => 'CRM_Mailing_BAO_MailingAB',
359 'type' => 'Select Date',
360 'formatType' => 'mailing',
365 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
367 return Civi
::$statics[__CLASS__
]['fields'];
371 * Return a mapping from field-name to the corresponding key (as used in fields()).
374 * Array(string $name => string $uniqueName).
376 public static function &fieldKeys() {
377 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
378 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
380 return Civi
::$statics[__CLASS__
]['fieldKeys'];
384 * Returns the names of this table
388 public static function getTableName() {
389 return self
::$_tableName;
393 * Returns if this table needs to be logged
397 public function getLog() {
402 * Returns the list of fields that can be imported
404 * @param bool $prefix
408 public static function &import($prefix = FALSE) {
409 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_abtest', $prefix, []);
414 * Returns the list of fields that can be exported
416 * @param bool $prefix
420 public static function &export($prefix = FALSE) {
421 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_abtest', $prefix, []);
426 * Returns the list of indices
428 * @param bool $localize
432 public static function indices($localize = TRUE) {
434 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;