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:ae76175a9d3e57bc555ce90cac672e73)
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 email address
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('Primary email'),
214 'description' => ts('Is this the primary email address'),
215 'where' => 'civicrm_email.is_primary',
217 'table_name' => 'civicrm_email',
219 'bao' => 'CRM_Core_BAO_Email',
226 'name' => 'is_billing',
227 'type' => CRM_Utils_Type
::T_BOOLEAN
,
228 'title' => ts('Is Billing Email?'),
229 'description' => ts('Is this the billing?'),
230 'where' => 'civicrm_email.is_billing',
232 'table_name' => 'civicrm_email',
234 'bao' => 'CRM_Core_BAO_Email',
239 'type' => CRM_Utils_Type
::T_INT
,
240 'title' => ts('On Hold'),
241 'description' => ts('Implicit FK to civicrm_option_value where option_group = email_on_hold.'),
243 'where' => 'civicrm_email.on_hold',
246 'table_name' => 'civicrm_email',
248 'bao' => 'CRM_Core_BAO_Email',
253 'pseudoconstant' => [
254 'callback' => 'CRM_Core_PseudoConstant::emailOnHoldOptions',
258 'name' => 'is_bulkmail',
259 'type' => CRM_Utils_Type
::T_BOOLEAN
,
260 'title' => ts('Use for Bulk Mail'),
261 'description' => ts('Is this address for bulk mail ?'),
263 'where' => 'civicrm_email.is_bulkmail',
266 'table_name' => 'civicrm_email',
268 'bao' => 'CRM_Core_BAO_Email',
272 'name' => 'hold_date',
273 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
274 'title' => ts('Hold Date'),
275 'description' => ts('When the address went on bounce hold'),
276 'where' => 'civicrm_email.hold_date',
277 'table_name' => 'civicrm_email',
279 'bao' => 'CRM_Core_BAO_Email',
283 'name' => 'reset_date',
284 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
285 'title' => ts('Reset Date'),
286 'description' => ts('When the address bounce status was last reset'),
287 'where' => 'civicrm_email.reset_date',
288 'table_name' => 'civicrm_email',
290 'bao' => 'CRM_Core_BAO_Email',
293 'signature_text' => [
294 'name' => 'signature_text',
295 'type' => CRM_Utils_Type
::T_TEXT
,
296 'title' => ts('Signature Text'),
297 'description' => ts('Text formatted signature for the email.'),
299 'where' => 'civicrm_email.signature_text',
302 'table_name' => 'civicrm_email',
304 'bao' => 'CRM_Core_BAO_Email',
307 'signature_html' => [
308 'name' => 'signature_html',
309 'type' => CRM_Utils_Type
::T_TEXT
,
310 'title' => ts('Signature Html'),
311 'description' => ts('HTML formatted signature for the email.'),
313 'where' => 'civicrm_email.signature_html',
316 'table_name' => 'civicrm_email',
318 'bao' => 'CRM_Core_BAO_Email',
322 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
324 return Civi
::$statics[__CLASS__
]['fields'];
328 * Return a mapping from field-name to the corresponding key (as used in fields()).
331 * Array(string $name => string $uniqueName).
333 public static function &fieldKeys() {
334 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
335 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
337 return Civi
::$statics[__CLASS__
]['fieldKeys'];
341 * Returns the names of this table
345 public static function getTableName() {
346 return self
::$_tableName;
350 * Returns if this table needs to be logged
354 public function getLog() {
359 * Returns the list of fields that can be imported
361 * @param bool $prefix
365 public static function &import($prefix = FALSE) {
366 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'email', $prefix, []);
371 * Returns the list of fields that can be exported
373 * @param bool $prefix
377 public static function &export($prefix = FALSE) {
378 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'email', $prefix, []);
383 * Returns the list of indices
385 * @param bool $localize
389 public static function indices($localize = TRUE) {
391 'index_location_type' => [
392 'name' => 'index_location_type',
394 0 => 'location_type_id',
396 'localizable' => FALSE,
397 'sig' => 'civicrm_email::0::location_type_id',
400 'name' => 'UI_email',
404 'localizable' => FALSE,
405 'sig' => 'civicrm_email::0::email',
407 'index_is_primary' => [
408 'name' => 'index_is_primary',
412 'localizable' => FALSE,
413 'sig' => 'civicrm_email::0::is_primary',
415 'index_is_billing' => [
416 'name' => 'index_is_billing',
420 'localizable' => FALSE,
421 'sig' => 'civicrm_email::0::is_billing',
424 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;