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