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:321767aa3e7c0ea7aac652b973d9603d)
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 static $_tableName = 'civicrm_mailing_recipients';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 'table_name' => 'civicrm_mailing_recipients',
104 'entity' => 'Recipients',
105 'bao' => 'CRM_Mailing_BAO_Recipients',
109 'name' => 'mailing_id',
110 'type' => CRM_Utils_Type
::T_INT
,
111 'title' => ts('Mailing'),
112 'description' => ts('The ID of the mailing this Job will send.'),
114 'table_name' => 'civicrm_mailing_recipients',
115 'entity' => 'Recipients',
116 'bao' => 'CRM_Mailing_BAO_Recipients',
118 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
121 'name' => 'contact_id',
122 'type' => CRM_Utils_Type
::T_INT
,
123 'title' => ts('Mailing Recipient'),
124 'description' => ts('FK to Contact'),
126 'table_name' => 'civicrm_mailing_recipients',
127 'entity' => 'Recipients',
128 'bao' => 'CRM_Mailing_BAO_Recipients',
130 'FKClassName' => 'CRM_Contact_DAO_Contact',
133 'name' => 'email_id',
134 'type' => CRM_Utils_Type
::T_INT
,
135 'title' => ts('Recipient Email'),
136 'description' => ts('FK to Email'),
138 'table_name' => 'civicrm_mailing_recipients',
139 'entity' => 'Recipients',
140 'bao' => 'CRM_Mailing_BAO_Recipients',
142 'FKClassName' => 'CRM_Core_DAO_Email',
145 'name' => 'phone_id',
146 'type' => CRM_Utils_Type
::T_INT
,
147 'title' => ts('Recipient Phone'),
148 'description' => ts('FK to Phone'),
150 'table_name' => 'civicrm_mailing_recipients',
151 'entity' => 'Recipients',
152 'bao' => 'CRM_Mailing_BAO_Recipients',
154 'FKClassName' => 'CRM_Core_DAO_Phone',
157 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
159 return Civi
::$statics[__CLASS__
]['fields'];
163 * Return a mapping from field-name to the corresponding key (as used in fields()).
166 * Array(string $name => string $uniqueName).
168 public static function &fieldKeys() {
169 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
170 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
172 return Civi
::$statics[__CLASS__
]['fieldKeys'];
176 * Returns the names of this table
180 public static function getTableName() {
181 return self
::$_tableName;
185 * Returns if this table needs to be logged
189 public function getLog() {
194 * Returns the list of fields that can be imported
196 * @param bool $prefix
200 public static function &import($prefix = FALSE) {
201 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_recipients', $prefix, []);
206 * Returns the list of fields that can be exported
208 * @param bool $prefix
212 public static function &export($prefix = FALSE) {
213 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_recipients', $prefix, []);
218 * Returns the list of indices
220 * @param bool $localize
224 public static function indices($localize = TRUE) {
226 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;