Merge pull request #23226 from MegaphoneJon/individual-employers
[civicrm-core.git] / CRM / Mailing / DAO / Recipients.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/Recipients.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:9b1fd81feabb976bc4447e5df79fb8ad)
10 */
11
12 /**
13 * Database access object for the Recipients entity.
14 */
15 class CRM_Mailing_DAO_Recipients extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18 const COMPONENT = 'CiviMail';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_mailing_recipients';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = FALSE;
33
34 /**
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
38 */
39 public $id;
40
41 /**
42 * The ID of the mailing this Job will send.
43 *
44 * @var int|string
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
47 */
48 public $mailing_id;
49
50 /**
51 * FK to Contact
52 *
53 * @var int|string
54 * (SQL type: int unsigned)
55 * Note that values will be retrieved from the database as a string.
56 */
57 public $contact_id;
58
59 /**
60 * FK to Email
61 *
62 * @var int|string|null
63 * (SQL type: int unsigned)
64 * Note that values will be retrieved from the database as a string.
65 */
66 public $email_id;
67
68 /**
69 * FK to Phone
70 *
71 * @var int|string|null
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
74 */
75 public $phone_id;
76
77 /**
78 * Class constructor.
79 */
80 public function __construct() {
81 $this->__table = 'civicrm_mailing_recipients';
82 parent::__construct();
83 }
84
85 /**
86 * Returns localized title of this entity.
87 *
88 * @param bool $plural
89 * Whether to return the plural version of the title.
90 */
91 public static function getEntityTitle($plural = FALSE) {
92 return $plural ? ts('Recipients') : ts('Recipient');
93 }
94
95 /**
96 * Returns foreign keys and entity references.
97 *
98 * @return array
99 * [CRM_Core_Reference_Interface]
100 */
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']);
109 }
110 return Civi::$statics[__CLASS__]['links'];
111 }
112
113 /**
114 * Returns all the column names of this table
115 *
116 * @return array
117 */
118 public static function &fields() {
119 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
120 Civi::$statics[__CLASS__]['fields'] = [
121 'id' => [
122 'name' => 'id',
123 'type' => CRM_Utils_Type::T_INT,
124 'title' => ts('Mailing Recipients ID'),
125 'required' => TRUE,
126 'where' => 'civicrm_mailing_recipients.id',
127 'table_name' => 'civicrm_mailing_recipients',
128 'entity' => 'Recipients',
129 'bao' => 'CRM_Mailing_BAO_Recipients',
130 'localizable' => 0,
131 'html' => [
132 'type' => 'Number',
133 ],
134 'readonly' => TRUE,
135 'add' => NULL,
136 ],
137 'mailing_id' => [
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.'),
142 'required' => TRUE,
143 'where' => 'civicrm_mailing_recipients.mailing_id',
144 'table_name' => 'civicrm_mailing_recipients',
145 'entity' => 'Recipients',
146 'bao' => 'CRM_Mailing_BAO_Recipients',
147 'localizable' => 0,
148 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
149 'html' => [
150 'label' => ts("Mailing"),
151 ],
152 'add' => NULL,
153 ],
154 'contact_id' => [
155 'name' => 'contact_id',
156 'type' => CRM_Utils_Type::T_INT,
157 'title' => ts('Recipient ID'),
158 'description' => ts('FK to Contact'),
159 'required' => TRUE,
160 'where' => 'civicrm_mailing_recipients.contact_id',
161 'table_name' => 'civicrm_mailing_recipients',
162 'entity' => 'Recipients',
163 'bao' => 'CRM_Mailing_BAO_Recipients',
164 'localizable' => 0,
165 'FKClassName' => 'CRM_Contact_DAO_Contact',
166 'html' => [
167 'label' => ts("Recipient"),
168 ],
169 'add' => NULL,
170 ],
171 'email_id' => [
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',
177 'default' => NULL,
178 'table_name' => 'civicrm_mailing_recipients',
179 'entity' => 'Recipients',
180 'bao' => 'CRM_Mailing_BAO_Recipients',
181 'localizable' => 0,
182 'FKClassName' => 'CRM_Core_DAO_Email',
183 'html' => [
184 'label' => ts("Email"),
185 ],
186 'add' => NULL,
187 ],
188 'phone_id' => [
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',
194 'default' => NULL,
195 'table_name' => 'civicrm_mailing_recipients',
196 'entity' => 'Recipients',
197 'bao' => 'CRM_Mailing_BAO_Recipients',
198 'localizable' => 0,
199 'FKClassName' => 'CRM_Core_DAO_Phone',
200 'html' => [
201 'label' => ts("Phone"),
202 ],
203 'add' => NULL,
204 ],
205 ];
206 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
207 }
208 return Civi::$statics[__CLASS__]['fields'];
209 }
210
211 /**
212 * Return a mapping from field-name to the corresponding key (as used in fields()).
213 *
214 * @return array
215 * Array(string $name => string $uniqueName).
216 */
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()));
220 }
221 return Civi::$statics[__CLASS__]['fieldKeys'];
222 }
223
224 /**
225 * Returns the names of this table
226 *
227 * @return string
228 */
229 public static function getTableName() {
230 return self::$_tableName;
231 }
232
233 /**
234 * Returns if this table needs to be logged
235 *
236 * @return bool
237 */
238 public function getLog() {
239 return self::$_log;
240 }
241
242 /**
243 * Returns the list of fields that can be imported
244 *
245 * @param bool $prefix
246 *
247 * @return array
248 */
249 public static function &import($prefix = FALSE) {
250 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_recipients', $prefix, []);
251 return $r;
252 }
253
254 /**
255 * Returns the list of fields that can be exported
256 *
257 * @param bool $prefix
258 *
259 * @return array
260 */
261 public static function &export($prefix = FALSE) {
262 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_recipients', $prefix, []);
263 return $r;
264 }
265
266 /**
267 * Returns the list of indices
268 *
269 * @param bool $localize
270 *
271 * @return array
272 */
273 public static function indices($localize = TRUE) {
274 $indices = [];
275 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
276 }
277
278 }