5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Email.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:04c281c9aa6ce3a51e2e08273469ca9f)
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 * Icon associated with this entity.
29 public static $_icon = 'fa-envelope-o';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = TRUE;
53 * Which Location does this email belong to.
57 public $location_type_id;
67 * Is this the primary email address
74 * Is this the billing?
81 * Implicit FK to civicrm_option_value where option_group = email_on_hold.
88 * Is this address for bulk mail ?
95 * When the address went on bounce hold
102 * When the address bounce status was last reset
109 * Text formatted signature for the email.
113 public $signature_text;
116 * HTML formatted signature for the email.
120 public $signature_html;
125 public function __construct() {
126 $this->__table
= 'civicrm_email';
127 parent
::__construct();
131 * Returns localized title of this entity.
133 public static function getEntityTitle() {
138 * Returns foreign keys and entity references.
141 * [CRM_Core_Reference_Interface]
143 public static function getReferenceColumns() {
144 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
145 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
146 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
147 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
149 return Civi
::$statics[__CLASS__
]['links'];
153 * Returns all the column names of this table
157 public static function &fields() {
158 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
159 Civi
::$statics[__CLASS__
]['fields'] = [
162 'type' => CRM_Utils_Type
::T_INT
,
163 'title' => ts('Email ID'),
164 'description' => ts('Unique Email ID'),
166 'where' => 'civicrm_email.id',
167 'table_name' => 'civicrm_email',
169 'bao' => 'CRM_Core_BAO_Email',
173 'name' => 'contact_id',
174 'type' => CRM_Utils_Type
::T_INT
,
175 'title' => ts('Email Contact'),
176 'description' => ts('FK to Contact ID'),
177 'where' => 'civicrm_email.contact_id',
178 'table_name' => 'civicrm_email',
180 'bao' => 'CRM_Core_BAO_Email',
182 'FKClassName' => 'CRM_Contact_DAO_Contact',
184 'location_type_id' => [
185 'name' => 'location_type_id',
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('Email Location Type'),
188 'description' => ts('Which Location does this email belong to.'),
189 'where' => 'civicrm_email.location_type_id',
190 'table_name' => 'civicrm_email',
192 'bao' => 'CRM_Core_BAO_Email',
197 'pseudoconstant' => [
198 'table' => 'civicrm_location_type',
200 'labelColumn' => 'display_name',
205 'type' => CRM_Utils_Type
::T_STRING
,
206 'title' => ts('Email'),
207 'description' => ts('Email address'),
211 'where' => 'civicrm_email.email',
212 'headerPattern' => '/e.?mail/i',
213 '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]$/',
216 'table_name' => 'civicrm_email',
218 'bao' => 'CRM_Core_BAO_Email',
225 'name' => 'is_primary',
226 'type' => CRM_Utils_Type
::T_BOOLEAN
,
227 'title' => ts('Primary email'),
228 'description' => ts('Is this the primary email address'),
229 'where' => 'civicrm_email.is_primary',
231 'table_name' => 'civicrm_email',
233 'bao' => 'CRM_Core_BAO_Email',
240 'name' => 'is_billing',
241 'type' => CRM_Utils_Type
::T_BOOLEAN
,
242 'title' => ts('Is Billing Email?'),
243 'description' => ts('Is this the billing?'),
244 'where' => 'civicrm_email.is_billing',
246 'table_name' => 'civicrm_email',
248 'bao' => 'CRM_Core_BAO_Email',
253 'type' => CRM_Utils_Type
::T_INT
,
254 'title' => ts('On Hold'),
255 'description' => ts('Implicit FK to civicrm_option_value where option_group = email_on_hold.'),
257 'where' => 'civicrm_email.on_hold',
260 'table_name' => 'civicrm_email',
262 'bao' => 'CRM_Core_BAO_Email',
267 'pseudoconstant' => [
268 'callback' => 'CRM_Core_PseudoConstant::emailOnHoldOptions',
272 'name' => 'is_bulkmail',
273 'type' => CRM_Utils_Type
::T_BOOLEAN
,
274 'title' => ts('Use for Bulk Mail'),
275 'description' => ts('Is this address for bulk mail ?'),
277 'where' => 'civicrm_email.is_bulkmail',
280 'table_name' => 'civicrm_email',
282 'bao' => 'CRM_Core_BAO_Email',
286 'name' => 'hold_date',
287 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
288 'title' => ts('Hold Date'),
289 'description' => ts('When the address went on bounce hold'),
290 'where' => 'civicrm_email.hold_date',
291 'table_name' => 'civicrm_email',
293 'bao' => 'CRM_Core_BAO_Email',
297 'name' => 'reset_date',
298 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
299 'title' => ts('Reset Date'),
300 'description' => ts('When the address bounce status was last reset'),
301 'where' => 'civicrm_email.reset_date',
302 'table_name' => 'civicrm_email',
304 'bao' => 'CRM_Core_BAO_Email',
307 'signature_text' => [
308 'name' => 'signature_text',
309 'type' => CRM_Utils_Type
::T_TEXT
,
310 'title' => ts('Signature Text'),
311 'description' => ts('Text formatted signature for the email.'),
313 'where' => 'civicrm_email.signature_text',
316 'table_name' => 'civicrm_email',
318 'bao' => 'CRM_Core_BAO_Email',
321 'signature_html' => [
322 'name' => 'signature_html',
323 'type' => CRM_Utils_Type
::T_TEXT
,
324 'title' => ts('Signature Html'),
325 'description' => ts('HTML formatted signature for the email.'),
327 'where' => 'civicrm_email.signature_html',
330 'table_name' => 'civicrm_email',
332 'bao' => 'CRM_Core_BAO_Email',
336 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
338 return Civi
::$statics[__CLASS__
]['fields'];
342 * Return a mapping from field-name to the corresponding key (as used in fields()).
345 * Array(string $name => string $uniqueName).
347 public static function &fieldKeys() {
348 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
349 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
351 return Civi
::$statics[__CLASS__
]['fieldKeys'];
355 * Returns the names of this table
359 public static function getTableName() {
360 return self
::$_tableName;
364 * Returns if this table needs to be logged
368 public function getLog() {
373 * Returns the list of fields that can be imported
375 * @param bool $prefix
379 public static function &import($prefix = FALSE) {
380 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'email', $prefix, []);
385 * Returns the list of fields that can be exported
387 * @param bool $prefix
391 public static function &export($prefix = FALSE) {
392 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'email', $prefix, []);
397 * Returns the list of indices
399 * @param bool $localize
403 public static function indices($localize = TRUE) {
405 'index_location_type' => [
406 'name' => 'index_location_type',
408 0 => 'location_type_id',
410 'localizable' => FALSE,
411 'sig' => 'civicrm_email::0::location_type_id',
414 'name' => 'UI_email',
418 'localizable' => FALSE,
419 'sig' => 'civicrm_email::0::email',
421 'index_is_primary' => [
422 'name' => 'index_is_primary',
426 'localizable' => FALSE,
427 'sig' => 'civicrm_email::0::is_primary',
429 'index_is_billing' => [
430 'name' => 'index_is_billing',
434 'localizable' => FALSE,
435 'sig' => 'civicrm_email::0::is_billing',
438 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;