Merge pull request #17506 from mattwire/propertybagremovewarning
[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
449c4e6b 9 * (GenCodeChecksum:6f300d432494c6b7df0480c1768290c8)
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
449c4e6b
CW
114 /**
115 * Returns localized title of this entity.
116 */
117 public static function getEntityTitle() {
118 return ts('Mailing Jobs');
119 }
120
e501603b 121 /**
f41f0342 122 * Returns foreign keys and entity references.
e501603b
TO
123 *
124 * @return array
125 * [CRM_Core_Reference_Interface]
126 */
c3fc2621 127 public static function getReferenceColumns() {
346aaaba 128 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 129 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
130 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
131 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_mailing_job', 'id');
346aaaba 132 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 133 }
346aaaba 134 return Civi::$statics[__CLASS__]['links'];
e501603b 135 }
c3fc2621 136
e501603b
TO
137 /**
138 * Returns all the column names of this table
139 *
140 * @return array
141 */
c3fc2621 142 public static function &fields() {
346aaaba 143 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
144 Civi::$statics[__CLASS__]['fields'] = [
145 'id' => [
e501603b
TO
146 'name' => 'id',
147 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
148 'title' => ts('Mailing Job ID'),
149 'required' => TRUE,
a36434b9 150 'where' => 'civicrm_mailing_job.id',
522a26c9 151 'table_name' => 'civicrm_mailing_job',
152 'entity' => 'MailingJob',
153 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 154 'localizable' => 0,
c3fc2621
CW
155 ],
156 'mailing_id' => [
e501603b
TO
157 'name' => 'mailing_id',
158 'type' => CRM_Utils_Type::T_INT,
c3fc2621 159 'title' => ts('Mailing'),
215b423e 160 'description' => ts('The ID of the mailing this Job will send.'),
c3fc2621 161 'required' => TRUE,
a36434b9 162 'where' => 'civicrm_mailing_job.mailing_id',
522a26c9 163 'table_name' => 'civicrm_mailing_job',
164 'entity' => 'MailingJob',
165 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 166 'localizable' => 0,
e501603b 167 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
c3fc2621
CW
168 ],
169 'scheduled_date' => [
e501603b 170 'name' => 'scheduled_date',
6c2b97b7 171 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 172 'title' => ts('Mailing Scheduled Date'),
215b423e 173 'description' => ts('date on which this job was scheduled.'),
c3fc2621 174 'required' => FALSE,
a36434b9 175 'where' => 'civicrm_mailing_job.scheduled_date',
6c2b97b7 176 'default' => 'NULL',
522a26c9 177 'table_name' => 'civicrm_mailing_job',
178 'entity' => 'MailingJob',
179 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 180 'localizable' => 0,
2c2c4aa4 181 'html' => [
182 'type' => 'Select Date',
183 'formatType' => 'activityDateTime',
184 ],
c3fc2621 185 ],
de866a86 186 'mailing_job_start_date' => [
e501603b 187 'name' => 'start_date',
6c2b97b7 188 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 189 'title' => ts('Mailing Job Start Date'),
215b423e 190 'description' => ts('date on which this job was started.'),
c3fc2621 191 'required' => FALSE,
a36434b9 192 'where' => 'civicrm_mailing_job.start_date',
6c2b97b7 193 'default' => 'NULL',
522a26c9 194 'table_name' => 'civicrm_mailing_job',
195 'entity' => 'MailingJob',
196 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 197 'localizable' => 0,
de866a86 198 'unique_title' => ts('Mailing Start Date'),
2c2c4aa4 199 'html' => [
200 'type' => 'Select Date',
201 'formatType' => 'activityDateTime',
202 ],
c3fc2621
CW
203 ],
204 'end_date' => [
e501603b 205 'name' => 'end_date',
6c2b97b7 206 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 207 'title' => ts('Mailing Job End Date'),
215b423e 208 'description' => ts('date on which this job ended.'),
c3fc2621 209 'required' => FALSE,
a36434b9 210 'where' => 'civicrm_mailing_job.end_date',
6c2b97b7 211 'default' => 'NULL',
522a26c9 212 'table_name' => 'civicrm_mailing_job',
213 'entity' => 'MailingJob',
214 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 215 'localizable' => 0,
2c2c4aa4 216 'html' => [
217 'type' => 'Select Date',
218 'formatType' => 'activityDateTime',
219 ],
c3fc2621 220 ],
08d08c03 221 'mailing_job_status' => [
e501603b
TO
222 'name' => 'status',
223 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 224 'title' => ts('Mailing Job Status'),
215b423e 225 'description' => ts('The state of this job'),
e501603b
TO
226 'maxlength' => 12,
227 'size' => CRM_Utils_Type::TWELVE,
a36434b9 228 'where' => 'civicrm_mailing_job.status',
522a26c9 229 'table_name' => 'civicrm_mailing_job',
230 'entity' => 'MailingJob',
231 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 232 'localizable' => 0,
c3fc2621 233 'html' => [
e501603b 234 'type' => 'Select',
c3fc2621
CW
235 ],
236 'pseudoconstant' => [
e501603b 237 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
e6ca0a57 238 ],
c3fc2621
CW
239 ],
240 'is_test' => [
e501603b
TO
241 'name' => 'is_test',
242 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 243 'title' => ts('Mailing Job Is Test?'),
215b423e 244 'description' => ts('Is this job for a test mail?'),
a36434b9 245 'where' => 'civicrm_mailing_job.is_test',
45a83e42 246 'default' => '0',
522a26c9 247 'table_name' => 'civicrm_mailing_job',
248 'entity' => 'MailingJob',
249 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 250 'localizable' => 0,
c3fc2621
CW
251 ],
252 'job_type' => [
e501603b
TO
253 'name' => 'job_type',
254 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 255 'title' => ts('Mailing Job Type'),
215b423e 256 'description' => ts('Type of mailling job: null | child '),
e501603b
TO
257 'maxlength' => 255,
258 'size' => CRM_Utils_Type::HUGE,
a36434b9 259 'where' => 'civicrm_mailing_job.job_type',
522a26c9 260 'table_name' => 'civicrm_mailing_job',
261 'entity' => 'MailingJob',
262 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 263 'localizable' => 0,
c3fc2621
CW
264 ],
265 'parent_id' => [
e501603b
TO
266 'name' => 'parent_id',
267 'type' => CRM_Utils_Type::T_INT,
c3fc2621 268 'title' => ts('Mailing Job Parent'),
215b423e 269 'description' => ts('Parent job id'),
a36434b9 270 'where' => 'civicrm_mailing_job.parent_id',
e501603b 271 'default' => 'NULL',
522a26c9 272 'table_name' => 'civicrm_mailing_job',
273 'entity' => 'MailingJob',
274 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 275 'localizable' => 0,
e501603b 276 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
c3fc2621
CW
277 ],
278 'job_offset' => [
e501603b
TO
279 'name' => 'job_offset',
280 'type' => CRM_Utils_Type::T_INT,
c3fc2621 281 'title' => ts('Mailing Job Offset'),
215b423e 282 'description' => ts('Offset of the child job'),
a36434b9 283 'where' => 'civicrm_mailing_job.job_offset',
45a83e42 284 'default' => '0',
522a26c9 285 'table_name' => 'civicrm_mailing_job',
286 'entity' => 'MailingJob',
287 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 288 'localizable' => 0,
c3fc2621
CW
289 ],
290 'job_limit' => [
e501603b
TO
291 'name' => 'job_limit',
292 'type' => CRM_Utils_Type::T_INT,
c3fc2621 293 'title' => ts('Mailing Job Limit'),
215b423e 294 'description' => ts('Queue size limit for each child job'),
a36434b9 295 'where' => 'civicrm_mailing_job.job_limit',
45a83e42 296 'default' => '0',
522a26c9 297 'table_name' => 'civicrm_mailing_job',
298 'entity' => 'MailingJob',
299 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 300 'localizable' => 0,
c3fc2621
CW
301 ],
302 ];
346aaaba 303 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 304 }
346aaaba 305 return Civi::$statics[__CLASS__]['fields'];
e501603b 306 }
c3fc2621 307
e501603b 308 /**
bd8e0b14 309 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
310 *
311 * @return array
bd8e0b14 312 * Array(string $name => string $uniqueName).
e501603b 313 */
c3fc2621 314 public static function &fieldKeys() {
bd8e0b14
TO
315 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
316 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 317 }
bd8e0b14 318 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 319 }
c3fc2621 320
e501603b
TO
321 /**
322 * Returns the names of this table
323 *
324 * @return string
325 */
c3fc2621 326 public static function getTableName() {
e501603b
TO
327 return self::$_tableName;
328 }
c3fc2621 329
e501603b
TO
330 /**
331 * Returns if this table needs to be logged
332 *
c3fc2621 333 * @return bool
e501603b 334 */
c3fc2621 335 public function getLog() {
e501603b
TO
336 return self::$_log;
337 }
c3fc2621 338
e501603b
TO
339 /**
340 * Returns the list of fields that can be imported
341 *
342 * @param bool $prefix
343 *
344 * @return array
345 */
c3fc2621
CW
346 public static function &import($prefix = FALSE) {
347 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, []);
60808919 348 return $r;
e501603b 349 }
c3fc2621 350
e501603b
TO
351 /**
352 * Returns the list of fields that can be exported
353 *
354 * @param bool $prefix
355 *
356 * @return array
357 */
c3fc2621
CW
358 public static function &export($prefix = FALSE) {
359 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, []);
60808919 360 return $r;
e501603b 361 }
c3fc2621 362
e7a6b91a
AS
363 /**
364 * Returns the list of indices
c3fc2621
CW
365 *
366 * @param bool $localize
367 *
368 * @return array
e7a6b91a
AS
369 */
370 public static function indices($localize = TRUE) {
c3fc2621 371 $indices = [];
e7a6b91a
AS
372 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
373 }
c3fc2621 374
e501603b 375}