Merge pull request #22967 from eileenmcnaughton/ret2
[civicrm-core.git] / CRM / Mailing / DAO / MailingJob.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/MailingJob.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:492e51f255632b9c3d87714bc9ca0f4d)
10 */
11
12 /**
13 * Database access object for the MailingJob entity.
14 */
15 class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18 const COMPONENT = 'CiviMail';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_mailing_job';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = FALSE;
33
34 /**
35 * @var int|string|null
36 * (SQL type: int unsigned)
37 * Note that values will be retrieved from the database as a string.
38 */
39 public $id;
40
41 /**
42 * The ID of the mailing this Job will send.
43 *
44 * @var int|string
45 * (SQL type: int unsigned)
46 * Note that values will be retrieved from the database as a string.
47 */
48 public $mailing_id;
49
50 /**
51 * date on which this job was scheduled.
52 *
53 * @var string
54 * (SQL type: timestamp)
55 * Note that values will be retrieved from the database as a string.
56 */
57 public $scheduled_date;
58
59 /**
60 * date on which this job was started.
61 *
62 * @var string
63 * (SQL type: timestamp)
64 * Note that values will be retrieved from the database as a string.
65 */
66 public $start_date;
67
68 /**
69 * date on which this job ended.
70 *
71 * @var string
72 * (SQL type: timestamp)
73 * Note that values will be retrieved from the database as a string.
74 */
75 public $end_date;
76
77 /**
78 * The state of this job
79 *
80 * @var string|null
81 * (SQL type: varchar(12))
82 * Note that values will be retrieved from the database as a string.
83 */
84 public $status;
85
86 /**
87 * Is this job for a test mail?
88 *
89 * @var bool|string
90 * (SQL type: tinyint)
91 * Note that values will be retrieved from the database as a string.
92 */
93 public $is_test;
94
95 /**
96 * Type of mailling job: null | child
97 *
98 * @var string|null
99 * (SQL type: varchar(255))
100 * Note that values will be retrieved from the database as a string.
101 */
102 public $job_type;
103
104 /**
105 * Parent job id
106 *
107 * @var int|string|null
108 * (SQL type: int unsigned)
109 * Note that values will be retrieved from the database as a string.
110 */
111 public $parent_id;
112
113 /**
114 * Offset of the child job
115 *
116 * @var int|string|null
117 * (SQL type: int)
118 * Note that values will be retrieved from the database as a string.
119 */
120 public $job_offset;
121
122 /**
123 * Queue size limit for each child job
124 *
125 * @var int|string|null
126 * (SQL type: int)
127 * Note that values will be retrieved from the database as a string.
128 */
129 public $job_limit;
130
131 /**
132 * Class constructor.
133 */
134 public function __construct() {
135 $this->__table = 'civicrm_mailing_job';
136 parent::__construct();
137 }
138
139 /**
140 * Returns localized title of this entity.
141 *
142 * @param bool $plural
143 * Whether to return the plural version of the title.
144 */
145 public static function getEntityTitle($plural = FALSE) {
146 return $plural ? ts('Mailing Jobs') : ts('Mailing Job');
147 }
148
149 /**
150 * Returns foreign keys and entity references.
151 *
152 * @return array
153 * [CRM_Core_Reference_Interface]
154 */
155 public static function getReferenceColumns() {
156 if (!isset(Civi::$statics[__CLASS__]['links'])) {
157 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
158 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
159 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_mailing_job', 'id');
160 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
161 }
162 return Civi::$statics[__CLASS__]['links'];
163 }
164
165 /**
166 * Returns all the column names of this table
167 *
168 * @return array
169 */
170 public static function &fields() {
171 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
172 Civi::$statics[__CLASS__]['fields'] = [
173 'id' => [
174 'name' => 'id',
175 'type' => CRM_Utils_Type::T_INT,
176 'title' => ts('Mailing Job ID'),
177 'required' => TRUE,
178 'where' => 'civicrm_mailing_job.id',
179 'table_name' => 'civicrm_mailing_job',
180 'entity' => 'MailingJob',
181 'bao' => 'CRM_Mailing_BAO_MailingJob',
182 'localizable' => 0,
183 'html' => [
184 'type' => 'Number',
185 ],
186 'readonly' => TRUE,
187 'add' => NULL,
188 ],
189 'mailing_id' => [
190 'name' => 'mailing_id',
191 'type' => CRM_Utils_Type::T_INT,
192 'title' => ts('Mailing ID'),
193 'description' => ts('The ID of the mailing this Job will send.'),
194 'required' => TRUE,
195 'where' => 'civicrm_mailing_job.mailing_id',
196 'table_name' => 'civicrm_mailing_job',
197 'entity' => 'MailingJob',
198 'bao' => 'CRM_Mailing_BAO_MailingJob',
199 'localizable' => 0,
200 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
201 'html' => [
202 'label' => ts("Mailing"),
203 ],
204 'add' => NULL,
205 ],
206 'scheduled_date' => [
207 'name' => 'scheduled_date',
208 'type' => CRM_Utils_Type::T_TIMESTAMP,
209 'title' => ts('Mailing Scheduled Date'),
210 'description' => ts('date on which this job was scheduled.'),
211 'required' => FALSE,
212 'where' => 'civicrm_mailing_job.scheduled_date',
213 'default' => NULL,
214 'table_name' => 'civicrm_mailing_job',
215 'entity' => 'MailingJob',
216 'bao' => 'CRM_Mailing_BAO_MailingJob',
217 'localizable' => 0,
218 'html' => [
219 'type' => 'Select Date',
220 'formatType' => 'activityDateTime',
221 ],
222 'add' => NULL,
223 ],
224 'mailing_job_start_date' => [
225 'name' => 'start_date',
226 'type' => CRM_Utils_Type::T_TIMESTAMP,
227 'title' => ts('Mailing Job Start Date'),
228 'description' => ts('date on which this job was started.'),
229 'required' => FALSE,
230 'where' => 'civicrm_mailing_job.start_date',
231 'default' => NULL,
232 'table_name' => 'civicrm_mailing_job',
233 'entity' => 'MailingJob',
234 'bao' => 'CRM_Mailing_BAO_MailingJob',
235 'localizable' => 0,
236 'unique_title' => ts('Mailing Start Date'),
237 'html' => [
238 'type' => 'Select Date',
239 'formatType' => 'activityDateTime',
240 ],
241 'add' => NULL,
242 ],
243 'end_date' => [
244 'name' => 'end_date',
245 'type' => CRM_Utils_Type::T_TIMESTAMP,
246 'title' => ts('Mailing Job End Date'),
247 'description' => ts('date on which this job ended.'),
248 'required' => FALSE,
249 'where' => 'civicrm_mailing_job.end_date',
250 'default' => NULL,
251 'table_name' => 'civicrm_mailing_job',
252 'entity' => 'MailingJob',
253 'bao' => 'CRM_Mailing_BAO_MailingJob',
254 'localizable' => 0,
255 'html' => [
256 'type' => 'Select Date',
257 'formatType' => 'activityDateTime',
258 ],
259 'add' => NULL,
260 ],
261 'mailing_job_status' => [
262 'name' => 'status',
263 'type' => CRM_Utils_Type::T_STRING,
264 'title' => ts('Mailing Job Status'),
265 'description' => ts('The state of this job'),
266 'maxlength' => 12,
267 'size' => CRM_Utils_Type::TWELVE,
268 'where' => 'civicrm_mailing_job.status',
269 'table_name' => 'civicrm_mailing_job',
270 'entity' => 'MailingJob',
271 'bao' => 'CRM_Mailing_BAO_MailingJob',
272 'localizable' => 0,
273 'html' => [
274 'type' => 'Select',
275 ],
276 'pseudoconstant' => [
277 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
278 ],
279 'add' => NULL,
280 ],
281 'is_test' => [
282 'name' => 'is_test',
283 'type' => CRM_Utils_Type::T_BOOLEAN,
284 'title' => ts('Mailing Job Is Test?'),
285 'description' => ts('Is this job for a test mail?'),
286 'required' => TRUE,
287 'where' => 'civicrm_mailing_job.is_test',
288 'default' => '0',
289 'table_name' => 'civicrm_mailing_job',
290 'entity' => 'MailingJob',
291 'bao' => 'CRM_Mailing_BAO_MailingJob',
292 'localizable' => 0,
293 'add' => '1.9',
294 ],
295 'job_type' => [
296 'name' => 'job_type',
297 'type' => CRM_Utils_Type::T_STRING,
298 'title' => ts('Mailing Job Type'),
299 'description' => ts('Type of mailling job: null | child '),
300 'maxlength' => 255,
301 'size' => CRM_Utils_Type::HUGE,
302 'where' => 'civicrm_mailing_job.job_type',
303 'table_name' => 'civicrm_mailing_job',
304 'entity' => 'MailingJob',
305 'bao' => 'CRM_Mailing_BAO_MailingJob',
306 'localizable' => 0,
307 'add' => '3.3',
308 ],
309 'parent_id' => [
310 'name' => 'parent_id',
311 'type' => CRM_Utils_Type::T_INT,
312 'title' => ts('Parent ID'),
313 'description' => ts('Parent job id'),
314 'where' => 'civicrm_mailing_job.parent_id',
315 'default' => NULL,
316 'table_name' => 'civicrm_mailing_job',
317 'entity' => 'MailingJob',
318 'bao' => 'CRM_Mailing_BAO_MailingJob',
319 'localizable' => 0,
320 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
321 'html' => [
322 'label' => ts("Parent"),
323 ],
324 'add' => '3.3',
325 ],
326 'job_offset' => [
327 'name' => 'job_offset',
328 'type' => CRM_Utils_Type::T_INT,
329 'title' => ts('Mailing Job Offset'),
330 'description' => ts('Offset of the child job'),
331 'where' => 'civicrm_mailing_job.job_offset',
332 'default' => '0',
333 'table_name' => 'civicrm_mailing_job',
334 'entity' => 'MailingJob',
335 'bao' => 'CRM_Mailing_BAO_MailingJob',
336 'localizable' => 0,
337 'add' => '3.3',
338 ],
339 'job_limit' => [
340 'name' => 'job_limit',
341 'type' => CRM_Utils_Type::T_INT,
342 'title' => ts('Mailing Job Limit'),
343 'description' => ts('Queue size limit for each child job'),
344 'where' => 'civicrm_mailing_job.job_limit',
345 'default' => '0',
346 'table_name' => 'civicrm_mailing_job',
347 'entity' => 'MailingJob',
348 'bao' => 'CRM_Mailing_BAO_MailingJob',
349 'localizable' => 0,
350 'add' => '3.3',
351 ],
352 ];
353 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
354 }
355 return Civi::$statics[__CLASS__]['fields'];
356 }
357
358 /**
359 * Return a mapping from field-name to the corresponding key (as used in fields()).
360 *
361 * @return array
362 * Array(string $name => string $uniqueName).
363 */
364 public static function &fieldKeys() {
365 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
366 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
367 }
368 return Civi::$statics[__CLASS__]['fieldKeys'];
369 }
370
371 /**
372 * Returns the names of this table
373 *
374 * @return string
375 */
376 public static function getTableName() {
377 return self::$_tableName;
378 }
379
380 /**
381 * Returns if this table needs to be logged
382 *
383 * @return bool
384 */
385 public function getLog() {
386 return self::$_log;
387 }
388
389 /**
390 * Returns the list of fields that can be imported
391 *
392 * @param bool $prefix
393 *
394 * @return array
395 */
396 public static function &import($prefix = FALSE) {
397 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, []);
398 return $r;
399 }
400
401 /**
402 * Returns the list of fields that can be exported
403 *
404 * @param bool $prefix
405 *
406 * @return array
407 */
408 public static function &export($prefix = FALSE) {
409 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, []);
410 return $r;
411 }
412
413 /**
414 * Returns the list of indices
415 *
416 * @param bool $localize
417 *
418 * @return array
419 */
420 public static function indices($localize = TRUE) {
421 $indices = [];
422 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
423 }
424
425 }