Regenerate DAO files
[civicrm-core.git] / CRM / Mailing / DAO / MailingJob.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Mailing/MailingJob.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e7dbe1ca234cec93cb54192911b87297)
10 */
11
12 /**
13 * Database access object for the MailingJob entity.
14 */
15 class CRM_Mailing_DAO_MailingJob 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_job';
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 * date on which this job was scheduled.
45 *
46 * @var timestamp
47 */
48 public $scheduled_date;
49
50 /**
51 * date on which this job was started.
52 *
53 * @var timestamp
54 */
55 public $start_date;
56
57 /**
58 * date on which this job ended.
59 *
60 * @var timestamp
61 */
62 public $end_date;
63
64 /**
65 * The state of this job
66 *
67 * @var string
68 */
69 public $status;
70
71 /**
72 * Is this job for a test mail?
73 *
74 * @var bool
75 */
76 public $is_test;
77
78 /**
79 * Type of mailling job: null | child
80 *
81 * @var string
82 */
83 public $job_type;
84
85 /**
86 * Parent job id
87 *
88 * @var int
89 */
90 public $parent_id;
91
92 /**
93 * Offset of the child job
94 *
95 * @var int
96 */
97 public $job_offset;
98
99 /**
100 * Queue size limit for each child job
101 *
102 * @var int
103 */
104 public $job_limit;
105
106 /**
107 * Class constructor.
108 */
109 public function __construct() {
110 $this->__table = 'civicrm_mailing_job';
111 parent::__construct();
112 }
113
114 /**
115 * Returns foreign keys and entity references.
116 *
117 * @return array
118 * [CRM_Core_Reference_Interface]
119 */
120 public static function getReferenceColumns() {
121 if (!isset(Civi::$statics[__CLASS__]['links'])) {
122 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
123 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
124 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_mailing_job', 'id');
125 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
126 }
127 return Civi::$statics[__CLASS__]['links'];
128 }
129
130 /**
131 * Returns all the column names of this table
132 *
133 * @return array
134 */
135 public static function &fields() {
136 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
137 Civi::$statics[__CLASS__]['fields'] = [
138 'id' => [
139 'name' => 'id',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('Mailing Job ID'),
142 'required' => TRUE,
143 'where' => 'civicrm_mailing_job.id',
144 'table_name' => 'civicrm_mailing_job',
145 'entity' => 'MailingJob',
146 'bao' => 'CRM_Mailing_BAO_MailingJob',
147 'localizable' => 0,
148 ],
149 'mailing_id' => [
150 'name' => 'mailing_id',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('Mailing'),
153 'description' => ts('The ID of the mailing this Job will send.'),
154 'required' => TRUE,
155 'where' => 'civicrm_mailing_job.mailing_id',
156 'table_name' => 'civicrm_mailing_job',
157 'entity' => 'MailingJob',
158 'bao' => 'CRM_Mailing_BAO_MailingJob',
159 'localizable' => 0,
160 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
161 ],
162 'scheduled_date' => [
163 'name' => 'scheduled_date',
164 'type' => CRM_Utils_Type::T_TIMESTAMP,
165 'title' => ts('Mailing Scheduled Date'),
166 'description' => ts('date on which this job was scheduled.'),
167 'required' => FALSE,
168 'where' => 'civicrm_mailing_job.scheduled_date',
169 'default' => 'NULL',
170 'table_name' => 'civicrm_mailing_job',
171 'entity' => 'MailingJob',
172 'bao' => 'CRM_Mailing_BAO_MailingJob',
173 'localizable' => 0,
174 ],
175 'start_date' => [
176 'name' => 'start_date',
177 'type' => CRM_Utils_Type::T_TIMESTAMP,
178 'title' => ts('Mailing Job Start Date'),
179 'description' => ts('date on which this job was started.'),
180 'required' => FALSE,
181 'where' => 'civicrm_mailing_job.start_date',
182 'default' => 'NULL',
183 'table_name' => 'civicrm_mailing_job',
184 'entity' => 'MailingJob',
185 'bao' => 'CRM_Mailing_BAO_MailingJob',
186 'localizable' => 0,
187 ],
188 'end_date' => [
189 'name' => 'end_date',
190 'type' => CRM_Utils_Type::T_TIMESTAMP,
191 'title' => ts('Mailing Job End Date'),
192 'description' => ts('date on which this job ended.'),
193 'required' => FALSE,
194 'where' => 'civicrm_mailing_job.end_date',
195 'default' => 'NULL',
196 'table_name' => 'civicrm_mailing_job',
197 'entity' => 'MailingJob',
198 'bao' => 'CRM_Mailing_BAO_MailingJob',
199 'localizable' => 0,
200 ],
201 'status' => [
202 'name' => 'status',
203 'type' => CRM_Utils_Type::T_STRING,
204 'title' => ts('Mailing Job Status'),
205 'description' => ts('The state of this job'),
206 'maxlength' => 12,
207 'size' => CRM_Utils_Type::TWELVE,
208 'where' => 'civicrm_mailing_job.status',
209 'table_name' => 'civicrm_mailing_job',
210 'entity' => 'MailingJob',
211 'bao' => 'CRM_Mailing_BAO_MailingJob',
212 'localizable' => 0,
213 'html' => [
214 'type' => 'Select',
215 ],
216 'pseudoconstant' => [
217 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
218 ],
219 ],
220 'is_test' => [
221 'name' => 'is_test',
222 'type' => CRM_Utils_Type::T_BOOLEAN,
223 'title' => ts('Mailing Job Is Test?'),
224 'description' => ts('Is this job for a test mail?'),
225 'where' => 'civicrm_mailing_job.is_test',
226 'default' => '0',
227 'table_name' => 'civicrm_mailing_job',
228 'entity' => 'MailingJob',
229 'bao' => 'CRM_Mailing_BAO_MailingJob',
230 'localizable' => 0,
231 ],
232 'job_type' => [
233 'name' => 'job_type',
234 'type' => CRM_Utils_Type::T_STRING,
235 'title' => ts('Mailing Job Type'),
236 'description' => ts('Type of mailling job: null | child '),
237 'maxlength' => 255,
238 'size' => CRM_Utils_Type::HUGE,
239 'where' => 'civicrm_mailing_job.job_type',
240 'table_name' => 'civicrm_mailing_job',
241 'entity' => 'MailingJob',
242 'bao' => 'CRM_Mailing_BAO_MailingJob',
243 'localizable' => 0,
244 ],
245 'parent_id' => [
246 'name' => 'parent_id',
247 'type' => CRM_Utils_Type::T_INT,
248 'title' => ts('Mailing Job Parent'),
249 'description' => ts('Parent job id'),
250 'where' => 'civicrm_mailing_job.parent_id',
251 'default' => 'NULL',
252 'table_name' => 'civicrm_mailing_job',
253 'entity' => 'MailingJob',
254 'bao' => 'CRM_Mailing_BAO_MailingJob',
255 'localizable' => 0,
256 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
257 ],
258 'job_offset' => [
259 'name' => 'job_offset',
260 'type' => CRM_Utils_Type::T_INT,
261 'title' => ts('Mailing Job Offset'),
262 'description' => ts('Offset of the child job'),
263 'where' => 'civicrm_mailing_job.job_offset',
264 'default' => '0',
265 'table_name' => 'civicrm_mailing_job',
266 'entity' => 'MailingJob',
267 'bao' => 'CRM_Mailing_BAO_MailingJob',
268 'localizable' => 0,
269 ],
270 'job_limit' => [
271 'name' => 'job_limit',
272 'type' => CRM_Utils_Type::T_INT,
273 'title' => ts('Mailing Job Limit'),
274 'description' => ts('Queue size limit for each child job'),
275 'where' => 'civicrm_mailing_job.job_limit',
276 'default' => '0',
277 'table_name' => 'civicrm_mailing_job',
278 'entity' => 'MailingJob',
279 'bao' => 'CRM_Mailing_BAO_MailingJob',
280 'localizable' => 0,
281 ],
282 ];
283 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
284 }
285 return Civi::$statics[__CLASS__]['fields'];
286 }
287
288 /**
289 * Return a mapping from field-name to the corresponding key (as used in fields()).
290 *
291 * @return array
292 * Array(string $name => string $uniqueName).
293 */
294 public static function &fieldKeys() {
295 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
296 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
297 }
298 return Civi::$statics[__CLASS__]['fieldKeys'];
299 }
300
301 /**
302 * Returns the names of this table
303 *
304 * @return string
305 */
306 public static function getTableName() {
307 return self::$_tableName;
308 }
309
310 /**
311 * Returns if this table needs to be logged
312 *
313 * @return bool
314 */
315 public function getLog() {
316 return self::$_log;
317 }
318
319 /**
320 * Returns the list of fields that can be imported
321 *
322 * @param bool $prefix
323 *
324 * @return array
325 */
326 public static function &import($prefix = FALSE) {
327 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, []);
328 return $r;
329 }
330
331 /**
332 * Returns the list of fields that can be exported
333 *
334 * @param bool $prefix
335 *
336 * @return array
337 */
338 public static function &export($prefix = FALSE) {
339 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, []);
340 return $r;
341 }
342
343 /**
344 * Returns the list of indices
345 *
346 * @param bool $localize
347 *
348 * @return array
349 */
350 public static function indices($localize = TRUE) {
351 $indices = [];
352 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
353 }
354
355 }