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:589a6adc830c8f9197b5123e08b63ba3)
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 localized title of this entity.
75 public static function getEntityTitle() {
76 return ts('Recipientses');
80 * Returns foreign keys and entity references.
83 * [CRM_Core_Reference_Interface]
85 public static function getReferenceColumns() {
86 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
87 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
88 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
89 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
90 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_id', 'civicrm_email', 'id');
91 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'phone_id', 'civicrm_phone', 'id');
92 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
94 return Civi
::$statics[__CLASS__
]['links'];
98 * Returns all the column names of this table
102 public static function &fields() {
103 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
104 Civi
::$statics[__CLASS__
]['fields'] = [
107 'type' => CRM_Utils_Type
::T_INT
,
108 'title' => ts('Mailing Recipients ID'),
110 'where' => 'civicrm_mailing_recipients.id',
111 'table_name' => 'civicrm_mailing_recipients',
112 'entity' => 'Recipients',
113 'bao' => 'CRM_Mailing_BAO_Recipients',
118 'name' => 'mailing_id',
119 'type' => CRM_Utils_Type
::T_INT
,
120 'title' => ts('Mailing'),
121 'description' => ts('The ID of the mailing this Job will send.'),
123 'where' => 'civicrm_mailing_recipients.mailing_id',
124 'table_name' => 'civicrm_mailing_recipients',
125 'entity' => 'Recipients',
126 'bao' => 'CRM_Mailing_BAO_Recipients',
128 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
132 'name' => 'contact_id',
133 'type' => CRM_Utils_Type
::T_INT
,
134 'title' => ts('Mailing Recipient'),
135 'description' => ts('FK to Contact'),
137 'where' => 'civicrm_mailing_recipients.contact_id',
138 'table_name' => 'civicrm_mailing_recipients',
139 'entity' => 'Recipients',
140 'bao' => 'CRM_Mailing_BAO_Recipients',
142 'FKClassName' => 'CRM_Contact_DAO_Contact',
146 'name' => 'email_id',
147 'type' => CRM_Utils_Type
::T_INT
,
148 'title' => ts('Recipient Email'),
149 'description' => ts('FK to Email'),
150 'where' => 'civicrm_mailing_recipients.email_id',
152 'table_name' => 'civicrm_mailing_recipients',
153 'entity' => 'Recipients',
154 'bao' => 'CRM_Mailing_BAO_Recipients',
156 'FKClassName' => 'CRM_Core_DAO_Email',
160 'name' => 'phone_id',
161 'type' => CRM_Utils_Type
::T_INT
,
162 'title' => ts('Recipient Phone'),
163 'description' => ts('FK to Phone'),
164 'where' => 'civicrm_mailing_recipients.phone_id',
166 'table_name' => 'civicrm_mailing_recipients',
167 'entity' => 'Recipients',
168 'bao' => 'CRM_Mailing_BAO_Recipients',
170 'FKClassName' => 'CRM_Core_DAO_Phone',
174 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
176 return Civi
::$statics[__CLASS__
]['fields'];
180 * Return a mapping from field-name to the corresponding key (as used in fields()).
183 * Array(string $name => string $uniqueName).
185 public static function &fieldKeys() {
186 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
187 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
189 return Civi
::$statics[__CLASS__
]['fieldKeys'];
193 * Returns the names of this table
197 public static function getTableName() {
198 return self
::$_tableName;
202 * Returns if this table needs to be logged
206 public function getLog() {
211 * Returns the list of fields that can be imported
213 * @param bool $prefix
217 public static function &import($prefix = FALSE) {
218 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_recipients', $prefix, []);
223 * Returns the list of fields that can be exported
225 * @param bool $prefix
229 public static function &export($prefix = FALSE) {
230 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_recipients', $prefix, []);
235 * Returns the list of indices
237 * @param bool $localize
241 public static function indices($localize = TRUE) {
243 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;