Regenerate DAO files to have 'where' fields defined
[civicrm-core.git] / CRM / Mailing / DAO / Recipients.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Mailing/Recipients.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:321767aa3e7c0ea7aac652b973d9603d)
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 unsigned
33 */
34 public $id;
35
36 /**
37 * The ID of the mailing this Job will send.
38 *
39 * @var int unsigned
40 */
41 public $mailing_id;
42
43 /**
44 * FK to Contact
45 *
46 * @var int unsigned
47 */
48 public $contact_id;
49
50 /**
51 * FK to Email
52 *
53 * @var int unsigned
54 */
55 public $email_id;
56
57 /**
58 * FK to Phone
59 *
60 * @var int unsigned
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 foreign keys and entity references.
74 *
75 * @return array
76 * [CRM_Core_Reference_Interface]
77 */
78 public static function getReferenceColumns() {
79 if (!isset(Civi::$statics[__CLASS__]['links'])) {
80 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
81 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
82 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id');
84 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
85 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
86 }
87 return Civi::$statics[__CLASS__]['links'];
88 }
89
90 /**
91 * Returns all the column names of this table
92 *
93 * @return array
94 */
95 public static function &fields() {
96 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
97 Civi::$statics[__CLASS__]['fields'] = [
98 'id' => [
99 'name' => 'id',
100 'type' => CRM_Utils_Type::T_INT,
101 'title' => ts('Mailing Recipients ID'),
102 'required' => TRUE,
103 'where' => 'civicrm_mailing_recipients.id',
104 'table_name' => 'civicrm_mailing_recipients',
105 'entity' => 'Recipients',
106 'bao' => 'CRM_Mailing_BAO_Recipients',
107 'localizable' => 0,
108 ],
109 'mailing_id' => [
110 'name' => 'mailing_id',
111 'type' => CRM_Utils_Type::T_INT,
112 'title' => ts('Mailing'),
113 'description' => ts('The ID of the mailing this Job will send.'),
114 'required' => TRUE,
115 'where' => 'civicrm_mailing_recipients.mailing_id',
116 'table_name' => 'civicrm_mailing_recipients',
117 'entity' => 'Recipients',
118 'bao' => 'CRM_Mailing_BAO_Recipients',
119 'localizable' => 0,
120 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
121 ],
122 'contact_id' => [
123 'name' => 'contact_id',
124 'type' => CRM_Utils_Type::T_INT,
125 'title' => ts('Mailing Recipient'),
126 'description' => ts('FK to Contact'),
127 'required' => TRUE,
128 'where' => 'civicrm_mailing_recipients.contact_id',
129 'table_name' => 'civicrm_mailing_recipients',
130 'entity' => 'Recipients',
131 'bao' => 'CRM_Mailing_BAO_Recipients',
132 'localizable' => 0,
133 'FKClassName' => 'CRM_Contact_DAO_Contact',
134 ],
135 'email_id' => [
136 'name' => 'email_id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Recipient Email'),
139 'description' => ts('FK to Email'),
140 'where' => 'civicrm_mailing_recipients.email_id',
141 'default' => 'NULL',
142 'table_name' => 'civicrm_mailing_recipients',
143 'entity' => 'Recipients',
144 'bao' => 'CRM_Mailing_BAO_Recipients',
145 'localizable' => 0,
146 'FKClassName' => 'CRM_Core_DAO_Email',
147 ],
148 'phone_id' => [
149 'name' => 'phone_id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('Recipient Phone'),
152 'description' => ts('FK to Phone'),
153 'where' => 'civicrm_mailing_recipients.phone_id',
154 'default' => 'NULL',
155 'table_name' => 'civicrm_mailing_recipients',
156 'entity' => 'Recipients',
157 'bao' => 'CRM_Mailing_BAO_Recipients',
158 'localizable' => 0,
159 'FKClassName' => 'CRM_Core_DAO_Phone',
160 ],
161 ];
162 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
163 }
164 return Civi::$statics[__CLASS__]['fields'];
165 }
166
167 /**
168 * Return a mapping from field-name to the corresponding key (as used in fields()).
169 *
170 * @return array
171 * Array(string $name => string $uniqueName).
172 */
173 public static function &fieldKeys() {
174 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
175 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
176 }
177 return Civi::$statics[__CLASS__]['fieldKeys'];
178 }
179
180 /**
181 * Returns the names of this table
182 *
183 * @return string
184 */
185 public static function getTableName() {
186 return self::$_tableName;
187 }
188
189 /**
190 * Returns if this table needs to be logged
191 *
192 * @return bool
193 */
194 public function getLog() {
195 return self::$_log;
196 }
197
198 /**
199 * Returns the list of fields that can be imported
200 *
201 * @param bool $prefix
202 *
203 * @return array
204 */
205 public static function &import($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_recipients', $prefix, []);
207 return $r;
208 }
209
210 /**
211 * Returns the list of fields that can be exported
212 *
213 * @param bool $prefix
214 *
215 * @return array
216 */
217 public static function &export($prefix = FALSE) {
218 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_recipients', $prefix, []);
219 return $r;
220 }
221
222 /**
223 * Returns the list of indices
224 *
225 * @param bool $localize
226 *
227 * @return array
228 */
229 public static function indices($localize = TRUE) {
230 $indices = [];
231 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
232 }
233
234 }