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