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