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:9b1fd81feabb976bc4447e5df79fb8ad)
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;
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
42 * The ID of the mailing this Job will send.
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
62 * @var int|string|null
63 * (SQL type: int unsigned)
64 * Note that values will be retrieved from the database as a string.
71 * @var int|string|null
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
80 public function __construct() {
81 $this->__table
= 'civicrm_mailing_recipients';
82 parent
::__construct();
86 * Returns localized title of this entity.
89 * Whether to return the plural version of the title.
91 public static function getEntityTitle($plural = FALSE) {
92 return $plural ?
ts('Recipients') : ts('Recipient');
96 * Returns foreign keys and entity references.
99 * [CRM_Core_Reference_Interface]
101 public static function getReferenceColumns() {
102 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
103 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
104 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
105 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
106 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_id', 'civicrm_email', 'id');
107 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'phone_id', 'civicrm_phone', 'id');
108 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
110 return Civi
::$statics[__CLASS__
]['links'];
114 * Returns all the column names of this table
118 public static function &fields() {
119 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
120 Civi
::$statics[__CLASS__
]['fields'] = [
123 'type' => CRM_Utils_Type
::T_INT
,
124 'title' => ts('Mailing Recipients ID'),
126 'where' => 'civicrm_mailing_recipients.id',
127 'table_name' => 'civicrm_mailing_recipients',
128 'entity' => 'Recipients',
129 'bao' => 'CRM_Mailing_BAO_Recipients',
138 'name' => 'mailing_id',
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('Mailing ID'),
141 'description' => ts('The ID of the mailing this Job will send.'),
143 'where' => 'civicrm_mailing_recipients.mailing_id',
144 'table_name' => 'civicrm_mailing_recipients',
145 'entity' => 'Recipients',
146 'bao' => 'CRM_Mailing_BAO_Recipients',
148 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
150 'label' => ts("Mailing"),
155 'name' => 'contact_id',
156 'type' => CRM_Utils_Type
::T_INT
,
157 'title' => ts('Recipient ID'),
158 'description' => ts('FK to Contact'),
160 'where' => 'civicrm_mailing_recipients.contact_id',
161 'table_name' => 'civicrm_mailing_recipients',
162 'entity' => 'Recipients',
163 'bao' => 'CRM_Mailing_BAO_Recipients',
165 'FKClassName' => 'CRM_Contact_DAO_Contact',
167 'label' => ts("Recipient"),
172 'name' => 'email_id',
173 'type' => CRM_Utils_Type
::T_INT
,
174 'title' => ts('Email ID'),
175 'description' => ts('FK to Email'),
176 'where' => 'civicrm_mailing_recipients.email_id',
178 'table_name' => 'civicrm_mailing_recipients',
179 'entity' => 'Recipients',
180 'bao' => 'CRM_Mailing_BAO_Recipients',
182 'FKClassName' => 'CRM_Core_DAO_Email',
184 'label' => ts("Email"),
189 'name' => 'phone_id',
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Phone ID'),
192 'description' => ts('FK to Phone'),
193 'where' => 'civicrm_mailing_recipients.phone_id',
195 'table_name' => 'civicrm_mailing_recipients',
196 'entity' => 'Recipients',
197 'bao' => 'CRM_Mailing_BAO_Recipients',
199 'FKClassName' => 'CRM_Core_DAO_Phone',
201 'label' => ts("Phone"),
206 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
208 return Civi
::$statics[__CLASS__
]['fields'];
212 * Return a mapping from field-name to the corresponding key (as used in fields()).
215 * Array(string $name => string $uniqueName).
217 public static function &fieldKeys() {
218 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
219 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
221 return Civi
::$statics[__CLASS__
]['fieldKeys'];
225 * Returns the names of this table
229 public static function getTableName() {
230 return self
::$_tableName;
234 * Returns if this table needs to be logged
238 public function getLog() {
243 * Returns the list of fields that can be imported
245 * @param bool $prefix
249 public static function &import($prefix = FALSE) {
250 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_recipients', $prefix, []);
255 * Returns the list of fields that can be exported
257 * @param bool $prefix
261 public static function &export($prefix = FALSE) {
262 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_recipients', $prefix, []);
267 * Returns the list of indices
269 * @param bool $localize
273 public static function indices($localize = TRUE) {
275 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;