5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Core/Email.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:08f53d44527d7d174b4aa1bd545b028c)
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 static $_tableName = 'civicrm_email';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
46 * Which Location does this email belong to.
50 public $location_type_id;
60 * Is this the primary?
67 * Is this the billing?
74 * Is this address on bounce 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' => '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' => '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' => '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' => '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' => 'Is this the primary?',
212 'table_name' => 'civicrm_email',
214 'bao' => 'CRM_Core_BAO_Email',
218 'name' => 'is_billing',
219 'type' => CRM_Utils_Type
::T_BOOLEAN
,
220 'title' => ts('Is Billing Email?'),
221 'description' => 'Is this the billing?',
222 'table_name' => 'civicrm_email',
224 'bao' => 'CRM_Core_BAO_Email',
229 'type' => CRM_Utils_Type
::T_BOOLEAN
,
230 'title' => ts('On Hold'),
231 'description' => 'Is this address on bounce hold?',
234 'where' => 'civicrm_email.on_hold',
235 'headerPattern' => '',
237 'table_name' => 'civicrm_email',
239 'bao' => 'CRM_Core_BAO_Email',
242 'type' => 'CheckBox',
246 'name' => 'is_bulkmail',
247 'type' => CRM_Utils_Type
::T_BOOLEAN
,
248 'title' => ts('Use for Bulk Mail'),
249 'description' => 'Is this address for bulk mail ?',
252 'where' => 'civicrm_email.is_bulkmail',
253 'headerPattern' => '',
255 'table_name' => 'civicrm_email',
257 'bao' => 'CRM_Core_BAO_Email',
261 'name' => 'hold_date',
262 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
263 'title' => ts('Hold Date'),
264 'description' => 'When the address went on bounce hold',
265 'table_name' => 'civicrm_email',
267 'bao' => 'CRM_Core_BAO_Email',
271 'name' => 'reset_date',
272 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
273 'title' => ts('Reset Date'),
274 'description' => 'When the address bounce status was last reset',
275 'table_name' => 'civicrm_email',
277 'bao' => 'CRM_Core_BAO_Email',
280 'signature_text' => [
281 'name' => 'signature_text',
282 'type' => CRM_Utils_Type
::T_TEXT
,
283 'title' => ts('Signature Text'),
284 'description' => 'Text formatted signature for the email.',
286 'where' => 'civicrm_email.signature_text',
287 'headerPattern' => '',
291 'table_name' => 'civicrm_email',
293 'bao' => 'CRM_Core_BAO_Email',
296 'signature_html' => [
297 'name' => 'signature_html',
298 'type' => CRM_Utils_Type
::T_TEXT
,
299 'title' => ts('Signature Html'),
300 'description' => 'HTML formatted signature for the email.',
302 'where' => 'civicrm_email.signature_html',
303 'headerPattern' => '',
307 'table_name' => 'civicrm_email',
309 'bao' => 'CRM_Core_BAO_Email',
313 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
315 return Civi
::$statics[__CLASS__
]['fields'];
319 * Return a mapping from field-name to the corresponding key (as used in fields()).
322 * Array(string $name => string $uniqueName).
324 public static function &fieldKeys() {
325 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
326 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
328 return Civi
::$statics[__CLASS__
]['fieldKeys'];
332 * Returns the names of this table
336 public static function getTableName() {
337 return self
::$_tableName;
341 * Returns if this table needs to be logged
345 public function getLog() {
350 * Returns the list of fields that can be imported
352 * @param bool $prefix
356 public static function &import($prefix = FALSE) {
357 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'email', $prefix, []);
362 * Returns the list of fields that can be exported
364 * @param bool $prefix
368 public static function &export($prefix = FALSE) {
369 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'email', $prefix, []);
374 * Returns the list of indices
376 * @param bool $localize
380 public static function indices($localize = TRUE) {
382 'index_location_type' => [
383 'name' => 'index_location_type',
385 0 => 'location_type_id',
387 'localizable' => FALSE,
388 'sig' => 'civicrm_email::0::location_type_id',
391 'name' => 'UI_email',
395 'localizable' => FALSE,
396 'sig' => 'civicrm_email::0::email',
398 'index_is_primary' => [
399 'name' => 'index_is_primary',
403 'localizable' => FALSE,
404 'sig' => 'civicrm_email::0::is_primary',
406 'index_is_billing' => [
407 'name' => 'index_is_billing',
411 'localizable' => FALSE,
412 'sig' => 'civicrm_email::0::is_billing',
415 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;