5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Mailing/MailingAB.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:2ddb755cd73dfcc880467c192d4f4b6c)
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 foreign keys and entity references.
133 * [CRM_Core_Reference_Interface]
135 public static function getReferenceColumns() {
136 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
137 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
138 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
139 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
141 return Civi
::$statics[__CLASS__
]['links'];
145 * Returns all the column names of this table
149 public static function &fields() {
150 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
151 Civi
::$statics[__CLASS__
]['fields'] = [
154 'type' => CRM_Utils_Type
::T_INT
,
155 'title' => ts('MailingAB ID'),
157 'where' => 'civicrm_mailing_abtest.id',
158 'table_name' => 'civicrm_mailing_abtest',
159 'entity' => 'MailingAB',
160 'bao' => 'CRM_Mailing_BAO_MailingAB',
165 'type' => CRM_Utils_Type
::T_STRING
,
166 'title' => ts('Name'),
167 'description' => ts('Name of the A/B test'),
169 'size' => CRM_Utils_Type
::HUGE
,
170 'where' => 'civicrm_mailing_abtest.name',
171 'table_name' => 'civicrm_mailing_abtest',
172 'entity' => 'MailingAB',
173 'bao' => 'CRM_Mailing_BAO_MailingAB',
178 'type' => CRM_Utils_Type
::T_STRING
,
179 'title' => ts('Status'),
180 'description' => ts('Status'),
182 'size' => CRM_Utils_Type
::MEDIUM
,
183 'where' => 'civicrm_mailing_abtest.status',
184 'table_name' => 'civicrm_mailing_abtest',
185 'entity' => 'MailingAB',
186 'bao' => 'CRM_Mailing_BAO_MailingAB',
188 'pseudoconstant' => [
189 'callback' => 'CRM_Mailing_PseudoConstant::abStatus',
193 'name' => 'mailing_id_a',
194 'type' => CRM_Utils_Type
::T_INT
,
195 'title' => ts('Mailing ID (A)'),
196 'description' => ts('The first experimental mailing ("A" condition)'),
197 'where' => 'civicrm_mailing_abtest.mailing_id_a',
198 'table_name' => 'civicrm_mailing_abtest',
199 'entity' => 'MailingAB',
200 'bao' => 'CRM_Mailing_BAO_MailingAB',
204 'name' => 'mailing_id_b',
205 'type' => CRM_Utils_Type
::T_INT
,
206 'title' => ts('Mailing ID (B)'),
207 'description' => ts('The second experimental mailing ("B" condition)'),
208 'where' => 'civicrm_mailing_abtest.mailing_id_b',
209 'table_name' => 'civicrm_mailing_abtest',
210 'entity' => 'MailingAB',
211 'bao' => 'CRM_Mailing_BAO_MailingAB',
215 'name' => 'mailing_id_c',
216 'type' => CRM_Utils_Type
::T_INT
,
217 'title' => ts('Mailing ID (C)'),
218 'description' => ts('The final, general mailing (derived from A or B)'),
219 'where' => 'civicrm_mailing_abtest.mailing_id_c',
220 'table_name' => 'civicrm_mailing_abtest',
221 'entity' => 'MailingAB',
222 'bao' => 'CRM_Mailing_BAO_MailingAB',
226 'name' => 'domain_id',
227 'type' => CRM_Utils_Type
::T_INT
,
228 'title' => ts('Domain ID'),
229 'description' => ts('Which site is this mailing for'),
230 'where' => 'civicrm_mailing_abtest.domain_id',
231 'table_name' => 'civicrm_mailing_abtest',
232 'entity' => 'MailingAB',
233 'bao' => 'CRM_Mailing_BAO_MailingAB',
236 'testing_criteria' => [
237 'name' => 'testing_criteria',
238 'type' => CRM_Utils_Type
::T_STRING
,
239 'title' => ts('Testing Criteria'),
241 'size' => CRM_Utils_Type
::MEDIUM
,
242 'where' => 'civicrm_mailing_abtest.testing_criteria',
243 'table_name' => 'civicrm_mailing_abtest',
244 'entity' => 'MailingAB',
245 'bao' => 'CRM_Mailing_BAO_MailingAB',
247 'pseudoconstant' => [
248 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria',
251 'winner_criteria' => [
252 'name' => 'winner_criteria',
253 'type' => CRM_Utils_Type
::T_STRING
,
254 'title' => ts('Winner Criteria'),
256 'size' => CRM_Utils_Type
::MEDIUM
,
257 'where' => 'civicrm_mailing_abtest.winner_criteria',
258 'table_name' => 'civicrm_mailing_abtest',
259 'entity' => 'MailingAB',
260 'bao' => 'CRM_Mailing_BAO_MailingAB',
262 'pseudoconstant' => [
263 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria',
267 'name' => 'specific_url',
268 'type' => CRM_Utils_Type
::T_STRING
,
269 'title' => ts('URL for Winner Criteria'),
270 'description' => ts('What specific url to track'),
272 'size' => CRM_Utils_Type
::HUGE
,
273 'where' => 'civicrm_mailing_abtest.specific_url',
274 'table_name' => 'civicrm_mailing_abtest',
275 'entity' => 'MailingAB',
276 'bao' => 'CRM_Mailing_BAO_MailingAB',
279 'declare_winning_time' => [
280 'name' => 'declare_winning_time',
281 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
282 'title' => ts('Declaration Time'),
283 'description' => ts('In how much time to declare winner'),
284 'where' => 'civicrm_mailing_abtest.declare_winning_time',
285 'table_name' => 'civicrm_mailing_abtest',
286 'entity' => 'MailingAB',
287 'bao' => 'CRM_Mailing_BAO_MailingAB',
290 'group_percentage' => [
291 'name' => 'group_percentage',
292 'type' => CRM_Utils_Type
::T_INT
,
293 'title' => ts('Group Percentage'),
294 'where' => 'civicrm_mailing_abtest.group_percentage',
295 'table_name' => 'civicrm_mailing_abtest',
296 'entity' => 'MailingAB',
297 'bao' => 'CRM_Mailing_BAO_MailingAB',
301 'name' => 'created_id',
302 'type' => CRM_Utils_Type
::T_INT
,
303 'title' => ts('AB Test Created By'),
304 'description' => ts('FK to Contact ID'),
305 'where' => 'civicrm_mailing_abtest.created_id',
306 'table_name' => 'civicrm_mailing_abtest',
307 'entity' => 'MailingAB',
308 'bao' => 'CRM_Mailing_BAO_MailingAB',
310 'FKClassName' => 'CRM_Contact_DAO_Contact',
313 'name' => 'created_date',
314 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
315 'title' => ts('AB Test Created Date'),
316 'description' => ts('When was this item created'),
318 'where' => 'civicrm_mailing_abtest.created_date',
319 'default' => 'CURRENT_TIMESTAMP',
320 'table_name' => 'civicrm_mailing_abtest',
321 'entity' => 'MailingAB',
322 'bao' => 'CRM_Mailing_BAO_MailingAB',
325 'type' => 'Select Date',
329 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
331 return Civi
::$statics[__CLASS__
]['fields'];
335 * Return a mapping from field-name to the corresponding key (as used in fields()).
338 * Array(string $name => string $uniqueName).
340 public static function &fieldKeys() {
341 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
342 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
344 return Civi
::$statics[__CLASS__
]['fieldKeys'];
348 * Returns the names of this table
352 public static function getTableName() {
353 return self
::$_tableName;
357 * Returns if this table needs to be logged
361 public function getLog() {
366 * Returns the list of fields that can be imported
368 * @param bool $prefix
372 public static function &import($prefix = FALSE) {
373 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_abtest', $prefix, []);
378 * Returns the list of fields that can be exported
380 * @param bool $prefix
384 public static function &export($prefix = FALSE) {
385 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_abtest', $prefix, []);
390 * Returns the list of indices
392 * @param bool $localize
396 public static function indices($localize = TRUE) {
398 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;