Merge pull request #16736 from ixiam/dev_report_issue#27
[civicrm-core.git] / CRM / Mailing / DAO / Recipients.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Mailing/Recipients.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
a9d0587b 9 * (GenCodeChecksum:589a6adc830c8f9197b5123e08b63ba3)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Recipients entity.
f41f0342 14 */
e501603b 15class CRM_Mailing_DAO_Recipients extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_mailing_recipients';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b 31 /**
e6ca0a57 32 * @var int
e501603b
TO
33 */
34 public $id;
c3fc2621 35
e501603b
TO
36 /**
37 * The ID of the mailing this Job will send.
38 *
e6ca0a57 39 * @var int
e501603b
TO
40 */
41 public $mailing_id;
c3fc2621 42
e501603b
TO
43 /**
44 * FK to Contact
45 *
e6ca0a57 46 * @var int
e501603b
TO
47 */
48 public $contact_id;
c3fc2621 49
e501603b
TO
50 /**
51 * FK to Email
52 *
e6ca0a57 53 * @var int
e501603b
TO
54 */
55 public $email_id;
c3fc2621 56
e501603b
TO
57 /**
58 * FK to Phone
59 *
e6ca0a57 60 * @var int
e501603b
TO
61 */
62 public $phone_id;
c3fc2621 63
e501603b 64 /**
f41f0342 65 * Class constructor.
e501603b 66 */
c3fc2621 67 public function __construct() {
e501603b
TO
68 $this->__table = 'civicrm_mailing_recipients';
69 parent::__construct();
70 }
c3fc2621 71
449c4e6b
CW
72 /**
73 * Returns localized title of this entity.
74 */
75 public static function getEntityTitle() {
76 return ts('Recipientses');
77 }
78
e501603b 79 /**
f41f0342 80 * Returns foreign keys and entity references.
e501603b
TO
81 *
82 * @return array
83 * [CRM_Core_Reference_Interface]
84 */
c3fc2621 85 public static function getReferenceColumns() {
346aaaba 86 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 87 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
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');
346aaaba 92 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 93 }
346aaaba 94 return Civi::$statics[__CLASS__]['links'];
e501603b 95 }
c3fc2621 96
e501603b
TO
97 /**
98 * Returns all the column names of this table
99 *
100 * @return array
101 */
c3fc2621 102 public static function &fields() {
346aaaba 103 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
104 Civi::$statics[__CLASS__]['fields'] = [
105 'id' => [
e501603b
TO
106 'name' => 'id',
107 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
108 'title' => ts('Mailing Recipients ID'),
109 'required' => TRUE,
a36434b9 110 'where' => 'civicrm_mailing_recipients.id',
522a26c9 111 'table_name' => 'civicrm_mailing_recipients',
112 'entity' => 'Recipients',
113 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 114 'localizable' => 0,
a9d0587b 115 'add' => NULL,
c3fc2621
CW
116 ],
117 'mailing_id' => [
e501603b
TO
118 'name' => 'mailing_id',
119 'type' => CRM_Utils_Type::T_INT,
c3fc2621 120 'title' => ts('Mailing'),
215b423e 121 'description' => ts('The ID of the mailing this Job will send.'),
c3fc2621 122 'required' => TRUE,
a36434b9 123 'where' => 'civicrm_mailing_recipients.mailing_id',
522a26c9 124 'table_name' => 'civicrm_mailing_recipients',
125 'entity' => 'Recipients',
126 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 127 'localizable' => 0,
e501603b 128 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
a9d0587b 129 'add' => NULL,
c3fc2621
CW
130 ],
131 'contact_id' => [
e501603b
TO
132 'name' => 'contact_id',
133 'type' => CRM_Utils_Type::T_INT,
c3fc2621 134 'title' => ts('Mailing Recipient'),
215b423e 135 'description' => ts('FK to Contact'),
c3fc2621 136 'required' => TRUE,
a36434b9 137 'where' => 'civicrm_mailing_recipients.contact_id',
522a26c9 138 'table_name' => 'civicrm_mailing_recipients',
139 'entity' => 'Recipients',
140 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 141 'localizable' => 0,
e501603b 142 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 143 'add' => NULL,
c3fc2621
CW
144 ],
145 'email_id' => [
e501603b
TO
146 'name' => 'email_id',
147 'type' => CRM_Utils_Type::T_INT,
c3fc2621 148 'title' => ts('Recipient Email'),
215b423e 149 'description' => ts('FK to Email'),
a36434b9 150 'where' => 'civicrm_mailing_recipients.email_id',
e501603b 151 'default' => 'NULL',
522a26c9 152 'table_name' => 'civicrm_mailing_recipients',
153 'entity' => 'Recipients',
154 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 155 'localizable' => 0,
e501603b 156 'FKClassName' => 'CRM_Core_DAO_Email',
a9d0587b 157 'add' => NULL,
c3fc2621
CW
158 ],
159 'phone_id' => [
e501603b
TO
160 'name' => 'phone_id',
161 'type' => CRM_Utils_Type::T_INT,
c3fc2621 162 'title' => ts('Recipient Phone'),
215b423e 163 'description' => ts('FK to Phone'),
a36434b9 164 'where' => 'civicrm_mailing_recipients.phone_id',
e501603b 165 'default' => 'NULL',
522a26c9 166 'table_name' => 'civicrm_mailing_recipients',
167 'entity' => 'Recipients',
168 'bao' => 'CRM_Mailing_BAO_Recipients',
6a7e5e5d 169 'localizable' => 0,
e501603b 170 'FKClassName' => 'CRM_Core_DAO_Phone',
a9d0587b 171 'add' => NULL,
c3fc2621
CW
172 ],
173 ];
346aaaba 174 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 175 }
346aaaba 176 return Civi::$statics[__CLASS__]['fields'];
e501603b 177 }
c3fc2621 178
e501603b 179 /**
bd8e0b14 180 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
181 *
182 * @return array
bd8e0b14 183 * Array(string $name => string $uniqueName).
e501603b 184 */
c3fc2621 185 public static function &fieldKeys() {
bd8e0b14
TO
186 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
187 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 188 }
bd8e0b14 189 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 190 }
c3fc2621 191
e501603b
TO
192 /**
193 * Returns the names of this table
194 *
195 * @return string
196 */
c3fc2621 197 public static function getTableName() {
e501603b
TO
198 return self::$_tableName;
199 }
c3fc2621 200
e501603b
TO
201 /**
202 * Returns if this table needs to be logged
203 *
c3fc2621 204 * @return bool
e501603b 205 */
c3fc2621 206 public function getLog() {
e501603b
TO
207 return self::$_log;
208 }
c3fc2621 209
e501603b
TO
210 /**
211 * Returns the list of fields that can be imported
212 *
213 * @param bool $prefix
214 *
215 * @return array
216 */
c3fc2621
CW
217 public static function &import($prefix = FALSE) {
218 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_recipients', $prefix, []);
60808919 219 return $r;
e501603b 220 }
c3fc2621 221
e501603b
TO
222 /**
223 * Returns the list of fields that can be exported
224 *
225 * @param bool $prefix
226 *
227 * @return array
228 */
c3fc2621
CW
229 public static function &export($prefix = FALSE) {
230 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_recipients', $prefix, []);
60808919 231 return $r;
e501603b 232 }
c3fc2621 233
e7a6b91a
AS
234 /**
235 * Returns the list of indices
c3fc2621
CW
236 *
237 * @param bool $localize
238 *
239 * @return array
e7a6b91a
AS
240 */
241 public static function indices($localize = TRUE) {
c3fc2621 242 $indices = [];
e7a6b91a
AS
243 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
244 }
c3fc2621 245
e501603b 246}