5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Mailing/Recipients.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b5e7e162aa5154171c57d7de1e484d77)
13 * Database access object for the Recipients entity.
15 class CRM_Mailing_DAO_Recipients
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_mailing_recipients';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
37 * The ID of the mailing this Job will send.
67 public function __construct() {
68 $this->__table
= 'civicrm_mailing_recipients';
69 parent
::__construct();
73 * Returns foreign keys and entity references.
76 * [CRM_Core_Reference_Interface]
78 public static function getReferenceColumns() {
79 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
80 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
81 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
82 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
83 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_id', 'civicrm_email', 'id');
84 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'phone_id', 'civicrm_phone', 'id');
85 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
87 return Civi
::$statics[__CLASS__
]['links'];
91 * Returns all the column names of this table
95 public static function &fields() {
96 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
97 Civi
::$statics[__CLASS__
]['fields'] = [
100 'type' => CRM_Utils_Type
::T_INT
,
101 'title' => ts('Mailing Recipients ID'),
103 'where' => 'civicrm_mailing_recipients.id',
104 'table_name' => 'civicrm_mailing_recipients',
105 'entity' => 'Recipients',
106 'bao' => 'CRM_Mailing_BAO_Recipients',
110 'name' => 'mailing_id',
111 'type' => CRM_Utils_Type
::T_INT
,
112 'title' => ts('Mailing'),
113 'description' => ts('The ID of the mailing this Job will send.'),
115 'where' => 'civicrm_mailing_recipients.mailing_id',
116 'table_name' => 'civicrm_mailing_recipients',
117 'entity' => 'Recipients',
118 'bao' => 'CRM_Mailing_BAO_Recipients',
120 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
123 'name' => 'contact_id',
124 'type' => CRM_Utils_Type
::T_INT
,
125 'title' => ts('Mailing Recipient'),
126 'description' => ts('FK to Contact'),
128 'where' => 'civicrm_mailing_recipients.contact_id',
129 'table_name' => 'civicrm_mailing_recipients',
130 'entity' => 'Recipients',
131 'bao' => 'CRM_Mailing_BAO_Recipients',
133 'FKClassName' => 'CRM_Contact_DAO_Contact',
136 'name' => 'email_id',
137 'type' => CRM_Utils_Type
::T_INT
,
138 'title' => ts('Recipient Email'),
139 'description' => ts('FK to Email'),
140 'where' => 'civicrm_mailing_recipients.email_id',
142 'table_name' => 'civicrm_mailing_recipients',
143 'entity' => 'Recipients',
144 'bao' => 'CRM_Mailing_BAO_Recipients',
146 'FKClassName' => 'CRM_Core_DAO_Email',
149 'name' => 'phone_id',
150 'type' => CRM_Utils_Type
::T_INT
,
151 'title' => ts('Recipient Phone'),
152 'description' => ts('FK to Phone'),
153 'where' => 'civicrm_mailing_recipients.phone_id',
155 'table_name' => 'civicrm_mailing_recipients',
156 'entity' => 'Recipients',
157 'bao' => 'CRM_Mailing_BAO_Recipients',
159 'FKClassName' => 'CRM_Core_DAO_Phone',
162 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
164 return Civi
::$statics[__CLASS__
]['fields'];
168 * Return a mapping from field-name to the corresponding key (as used in fields()).
171 * Array(string $name => string $uniqueName).
173 public static function &fieldKeys() {
174 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
175 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
177 return Civi
::$statics[__CLASS__
]['fieldKeys'];
181 * Returns the names of this table
185 public static function getTableName() {
186 return self
::$_tableName;
190 * Returns if this table needs to be logged
194 public function getLog() {
199 * Returns the list of fields that can be imported
201 * @param bool $prefix
205 public static function &import($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_recipients', $prefix, []);
211 * Returns the list of fields that can be exported
213 * @param bool $prefix
217 public static function &export($prefix = FALSE) {
218 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_recipients', $prefix, []);
223 * Returns the list of indices
225 * @param bool $localize
229 public static function indices($localize = TRUE) {
231 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;