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