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:68301f75314731f6ee2ec37298fe49fe)
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 'where' => 'civicrm_email.id',
153 'table_name' => 'civicrm_email',
155 'bao' => 'CRM_Core_BAO_Email',
159 'name' => 'contact_id',
160 'type' => CRM_Utils_Type
::T_INT
,
161 'title' => ts('Email Contact'),
162 'description' => ts('FK to Contact ID'),
163 'where' => 'civicrm_email.contact_id',
164 'table_name' => 'civicrm_email',
166 'bao' => 'CRM_Core_BAO_Email',
168 'FKClassName' => 'CRM_Contact_DAO_Contact',
170 'location_type_id' => [
171 'name' => 'location_type_id',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Email Location Type'),
174 'description' => ts('Which Location does this email belong to.'),
175 'where' => 'civicrm_email.location_type_id',
176 'table_name' => 'civicrm_email',
178 'bao' => 'CRM_Core_BAO_Email',
183 'pseudoconstant' => [
184 'table' => 'civicrm_location_type',
186 'labelColumn' => 'display_name',
191 'type' => CRM_Utils_Type
::T_STRING
,
192 'title' => ts('Email'),
193 'description' => ts('Email address'),
197 'where' => 'civicrm_email.email',
198 'headerPattern' => '/e.?mail/i',
199 '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]$/',
202 'table_name' => 'civicrm_email',
204 'bao' => 'CRM_Core_BAO_Email',
211 'name' => 'is_primary',
212 'type' => CRM_Utils_Type
::T_BOOLEAN
,
213 'title' => ts('Is Primary email'),
214 'description' => ts('Is this the primary?'),
215 'where' => 'civicrm_email.is_primary',
217 'table_name' => 'civicrm_email',
219 'bao' => 'CRM_Core_BAO_Email',
223 'name' => 'is_billing',
224 'type' => CRM_Utils_Type
::T_BOOLEAN
,
225 'title' => ts('Is Billing Email?'),
226 'description' => ts('Is this the billing?'),
227 'where' => 'civicrm_email.is_billing',
229 'table_name' => 'civicrm_email',
231 'bao' => 'CRM_Core_BAO_Email',
236 'type' => CRM_Utils_Type
::T_INT
,
237 'title' => ts('On Hold'),
238 'description' => ts('Implicit FK to civicrm_option_value where option_group = email_on_hold.'),
240 'where' => 'civicrm_email.on_hold',
243 'table_name' => 'civicrm_email',
245 'bao' => 'CRM_Core_BAO_Email',
250 'pseudoconstant' => [
251 'callback' => 'CRM_Core_PseudoConstant::emailOnHoldOptions',
255 'name' => 'is_bulkmail',
256 'type' => CRM_Utils_Type
::T_BOOLEAN
,
257 'title' => ts('Use for Bulk Mail'),
258 'description' => ts('Is this address for bulk mail ?'),
260 'where' => 'civicrm_email.is_bulkmail',
263 'table_name' => 'civicrm_email',
265 'bao' => 'CRM_Core_BAO_Email',
269 'name' => 'hold_date',
270 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
271 'title' => ts('Hold Date'),
272 'description' => ts('When the address went on bounce hold'),
273 'where' => 'civicrm_email.hold_date',
274 'table_name' => 'civicrm_email',
276 'bao' => 'CRM_Core_BAO_Email',
280 'name' => 'reset_date',
281 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
282 'title' => ts('Reset Date'),
283 'description' => ts('When the address bounce status was last reset'),
284 'where' => 'civicrm_email.reset_date',
285 'table_name' => 'civicrm_email',
287 'bao' => 'CRM_Core_BAO_Email',
290 'signature_text' => [
291 'name' => 'signature_text',
292 'type' => CRM_Utils_Type
::T_TEXT
,
293 'title' => ts('Signature Text'),
294 'description' => ts('Text formatted signature for the email.'),
296 'where' => 'civicrm_email.signature_text',
299 'table_name' => 'civicrm_email',
301 'bao' => 'CRM_Core_BAO_Email',
304 'signature_html' => [
305 'name' => 'signature_html',
306 'type' => CRM_Utils_Type
::T_TEXT
,
307 'title' => ts('Signature Html'),
308 'description' => ts('HTML formatted signature for the email.'),
310 'where' => 'civicrm_email.signature_html',
313 'table_name' => 'civicrm_email',
315 'bao' => 'CRM_Core_BAO_Email',
319 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
321 return Civi
::$statics[__CLASS__
]['fields'];
325 * Return a mapping from field-name to the corresponding key (as used in fields()).
328 * Array(string $name => string $uniqueName).
330 public static function &fieldKeys() {
331 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
332 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
334 return Civi
::$statics[__CLASS__
]['fieldKeys'];
338 * Returns the names of this table
342 public static function getTableName() {
343 return self
::$_tableName;
347 * Returns if this table needs to be logged
351 public function getLog() {
356 * Returns the list of fields that can be imported
358 * @param bool $prefix
362 public static function &import($prefix = FALSE) {
363 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'email', $prefix, []);
368 * Returns the list of fields that can be exported
370 * @param bool $prefix
374 public static function &export($prefix = FALSE) {
375 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'email', $prefix, []);
380 * Returns the list of indices
382 * @param bool $localize
386 public static function indices($localize = TRUE) {
388 'index_location_type' => [
389 'name' => 'index_location_type',
391 0 => 'location_type_id',
393 'localizable' => FALSE,
394 'sig' => 'civicrm_email::0::location_type_id',
397 'name' => 'UI_email',
401 'localizable' => FALSE,
402 'sig' => 'civicrm_email::0::email',
404 'index_is_primary' => [
405 'name' => 'index_is_primary',
409 'localizable' => FALSE,
410 'sig' => 'civicrm_email::0::is_primary',
412 'index_is_billing' => [
413 'name' => 'index_is_billing',
417 'localizable' => FALSE,
418 'sig' => 'civicrm_email::0::is_billing',
421 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;