5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Mailing/Recipients.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b3c4d09f9c6afa1f96dc0d1cdbaec935)
13 * Database access object for the Recipients entity.
15 class CRM_Mailing_DAO_Recipients
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '';
18 const COMPONENT
= 'CiviMail';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_mailing_recipients';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
40 * The ID of the mailing this Job will send.
70 public function __construct() {
71 $this->__table
= 'civicrm_mailing_recipients';
72 parent
::__construct();
76 * Returns localized title of this entity.
79 * Whether to return the plural version of the title.
81 public static function getEntityTitle($plural = FALSE) {
82 return $plural ?
ts('Recipients') : ts('Recipient');
86 * Returns foreign keys and entity references.
89 * [CRM_Core_Reference_Interface]
91 public static function getReferenceColumns() {
92 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
93 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
94 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
95 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
96 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_id', 'civicrm_email', 'id');
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'phone_id', 'civicrm_phone', 'id');
98 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
100 return Civi
::$statics[__CLASS__
]['links'];
104 * Returns all the column names of this table
108 public static function &fields() {
109 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
110 Civi
::$statics[__CLASS__
]['fields'] = [
113 'type' => CRM_Utils_Type
::T_INT
,
114 'title' => ts('Mailing Recipients ID'),
116 'where' => 'civicrm_mailing_recipients.id',
117 'table_name' => 'civicrm_mailing_recipients',
118 'entity' => 'Recipients',
119 'bao' => 'CRM_Mailing_BAO_Recipients',
128 'name' => 'mailing_id',
129 'type' => CRM_Utils_Type
::T_INT
,
130 'title' => ts('Mailing ID'),
131 'description' => ts('The ID of the mailing this Job will send.'),
133 'where' => 'civicrm_mailing_recipients.mailing_id',
134 'table_name' => 'civicrm_mailing_recipients',
135 'entity' => 'Recipients',
136 'bao' => 'CRM_Mailing_BAO_Recipients',
138 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
140 'label' => ts("Mailing"),
145 'name' => 'contact_id',
146 'type' => CRM_Utils_Type
::T_INT
,
147 'title' => ts('Recipient ID'),
148 'description' => ts('FK to Contact'),
150 'where' => 'civicrm_mailing_recipients.contact_id',
151 'table_name' => 'civicrm_mailing_recipients',
152 'entity' => 'Recipients',
153 'bao' => 'CRM_Mailing_BAO_Recipients',
155 'FKClassName' => 'CRM_Contact_DAO_Contact',
157 'label' => ts("Recipient"),
162 'name' => 'email_id',
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Email ID'),
165 'description' => ts('FK to Email'),
166 'where' => 'civicrm_mailing_recipients.email_id',
168 'table_name' => 'civicrm_mailing_recipients',
169 'entity' => 'Recipients',
170 'bao' => 'CRM_Mailing_BAO_Recipients',
172 'FKClassName' => 'CRM_Core_DAO_Email',
174 'label' => ts("Email"),
179 'name' => 'phone_id',
180 'type' => CRM_Utils_Type
::T_INT
,
181 'title' => ts('Phone ID'),
182 'description' => ts('FK to Phone'),
183 'where' => 'civicrm_mailing_recipients.phone_id',
185 'table_name' => 'civicrm_mailing_recipients',
186 'entity' => 'Recipients',
187 'bao' => 'CRM_Mailing_BAO_Recipients',
189 'FKClassName' => 'CRM_Core_DAO_Phone',
191 'label' => ts("Phone"),
196 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
198 return Civi
::$statics[__CLASS__
]['fields'];
202 * Return a mapping from field-name to the corresponding key (as used in fields()).
205 * Array(string $name => string $uniqueName).
207 public static function &fieldKeys() {
208 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
209 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
211 return Civi
::$statics[__CLASS__
]['fieldKeys'];
215 * Returns the names of this table
219 public static function getTableName() {
220 return self
::$_tableName;
224 * Returns if this table needs to be logged
228 public function getLog() {
233 * Returns the list of fields that can be imported
235 * @param bool $prefix
239 public static function &import($prefix = FALSE) {
240 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_recipients', $prefix, []);
245 * Returns the list of fields that can be exported
247 * @param bool $prefix
251 public static function &export($prefix = FALSE) {
252 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_recipients', $prefix, []);
257 * Returns the list of indices
259 * @param bool $localize
263 public static function indices($localize = TRUE) {
265 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;