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