5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/Email.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:198627a1fa129294e4c7be52939883e1)
13 * Database access object for the Email entity.
15 class CRM_Core_DAO_Email
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_email';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
46 * Which Location does this email belong to.
50 public $location_type_id;
60 * Is this the primary?
67 * Is this the billing?
74 * Implicit FK to civicrm_option_value where option_group = email_on_hold.
81 * Is this address for bulk mail ?
88 * When the address went on bounce hold
95 * When the address bounce status was last reset
102 * Text formatted signature for the email.
106 public $signature_text;
109 * HTML formatted signature for the email.
113 public $signature_html;
118 public function __construct() {
119 $this->__table
= 'civicrm_email';
120 parent
::__construct();
124 * Returns foreign keys and entity references.
127 * [CRM_Core_Reference_Interface]
129 public static function getReferenceColumns() {
130 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
131 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
132 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
133 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
135 return Civi
::$statics[__CLASS__
]['links'];
139 * Returns all the column names of this table
143 public static function &fields() {
144 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
145 Civi
::$statics[__CLASS__
]['fields'] = [
148 'type' => CRM_Utils_Type
::T_INT
,
149 'title' => ts('Email ID'),
150 'description' => ts('Unique Email ID'),
152 'table_name' => 'civicrm_email',
154 'bao' => 'CRM_Core_BAO_Email',
158 'name' => 'contact_id',
159 'type' => CRM_Utils_Type
::T_INT
,
160 'title' => ts('Email Contact'),
161 'description' => ts('FK to Contact ID'),
162 'table_name' => 'civicrm_email',
164 'bao' => 'CRM_Core_BAO_Email',
166 'FKClassName' => 'CRM_Contact_DAO_Contact',
168 'location_type_id' => [
169 'name' => 'location_type_id',
170 'type' => CRM_Utils_Type
::T_INT
,
171 'title' => ts('Email Location Type'),
172 'description' => ts('Which Location does this email belong to.'),
173 'table_name' => 'civicrm_email',
175 'bao' => 'CRM_Core_BAO_Email',
180 'pseudoconstant' => [
181 'table' => 'civicrm_location_type',
183 'labelColumn' => 'display_name',
188 'type' => CRM_Utils_Type
::T_STRING
,
189 'title' => ts('Email'),
190 'description' => ts('Email address'),
194 'where' => 'civicrm_email.email',
195 'headerPattern' => '/e.?mail/i',
196 'dataPattern' => '/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/',
199 'table_name' => 'civicrm_email',
201 'bao' => 'CRM_Core_BAO_Email',
208 'name' => 'is_primary',
209 'type' => CRM_Utils_Type
::T_BOOLEAN
,
210 'title' => ts('Is Primary email'),
211 'description' => ts('Is this the primary?'),
213 'table_name' => 'civicrm_email',
215 'bao' => 'CRM_Core_BAO_Email',
219 'name' => 'is_billing',
220 'type' => CRM_Utils_Type
::T_BOOLEAN
,
221 'title' => ts('Is Billing Email?'),
222 'description' => ts('Is this the billing?'),
224 'table_name' => 'civicrm_email',
226 'bao' => 'CRM_Core_BAO_Email',
231 'type' => CRM_Utils_Type
::T_INT
,
232 'title' => ts('On Hold'),
233 'description' => ts('Implicit FK to civicrm_option_value where option_group = email_on_hold.'),
236 'where' => 'civicrm_email.on_hold',
237 'headerPattern' => '',
240 'table_name' => 'civicrm_email',
242 'bao' => 'CRM_Core_BAO_Email',
247 'pseudoconstant' => [
248 'callback' => 'CRM_Core_PseudoConstant::emailOnHoldOptions',
252 'name' => 'is_bulkmail',
253 'type' => CRM_Utils_Type
::T_BOOLEAN
,
254 'title' => ts('Use for Bulk Mail'),
255 'description' => ts('Is this address for bulk mail ?'),
258 'where' => 'civicrm_email.is_bulkmail',
259 'headerPattern' => '',
262 'table_name' => 'civicrm_email',
264 'bao' => 'CRM_Core_BAO_Email',
268 'name' => 'hold_date',
269 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
270 'title' => ts('Hold Date'),
271 'description' => ts('When the address went on bounce hold'),
272 'table_name' => 'civicrm_email',
274 'bao' => 'CRM_Core_BAO_Email',
278 'name' => 'reset_date',
279 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
280 'title' => ts('Reset Date'),
281 'description' => ts('When the address bounce status was last reset'),
282 'table_name' => 'civicrm_email',
284 'bao' => 'CRM_Core_BAO_Email',
287 'signature_text' => [
288 'name' => 'signature_text',
289 'type' => CRM_Utils_Type
::T_TEXT
,
290 'title' => ts('Signature Text'),
291 'description' => ts('Text formatted signature for the email.'),
293 'where' => 'civicrm_email.signature_text',
294 'headerPattern' => '',
298 'table_name' => 'civicrm_email',
300 'bao' => 'CRM_Core_BAO_Email',
303 'signature_html' => [
304 'name' => 'signature_html',
305 'type' => CRM_Utils_Type
::T_TEXT
,
306 'title' => ts('Signature Html'),
307 'description' => ts('HTML formatted signature for the email.'),
309 'where' => 'civicrm_email.signature_html',
310 'headerPattern' => '',
314 'table_name' => 'civicrm_email',
316 'bao' => 'CRM_Core_BAO_Email',
320 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
322 return Civi
::$statics[__CLASS__
]['fields'];
326 * Return a mapping from field-name to the corresponding key (as used in fields()).
329 * Array(string $name => string $uniqueName).
331 public static function &fieldKeys() {
332 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
333 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
335 return Civi
::$statics[__CLASS__
]['fieldKeys'];
339 * Returns the names of this table
343 public static function getTableName() {
344 return self
::$_tableName;
348 * Returns if this table needs to be logged
352 public function getLog() {
357 * Returns the list of fields that can be imported
359 * @param bool $prefix
363 public static function &import($prefix = FALSE) {
364 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'email', $prefix, []);
369 * Returns the list of fields that can be exported
371 * @param bool $prefix
375 public static function &export($prefix = FALSE) {
376 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'email', $prefix, []);
381 * Returns the list of indices
383 * @param bool $localize
387 public static function indices($localize = TRUE) {
389 'index_location_type' => [
390 'name' => 'index_location_type',
392 0 => 'location_type_id',
394 'localizable' => FALSE,
395 'sig' => 'civicrm_email::0::location_type_id',
398 'name' => 'UI_email',
402 'localizable' => FALSE,
403 'sig' => 'civicrm_email::0::email',
405 'index_is_primary' => [
406 'name' => 'index_is_primary',
410 'localizable' => FALSE,
411 'sig' => 'civicrm_email::0::is_primary',
413 'index_is_billing' => [
414 'name' => 'index_is_billing',
418 'localizable' => FALSE,
419 'sig' => 'civicrm_email::0::is_billing',
422 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;