Add "labelField" metadata to entities
[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
8ab43c93 9 * (GenCodeChecksum:16d3f472e9379145910fa49ef5d2576a)
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,
a9d0587b 161 'add' => NULL,
c3fc2621
CW
162 ],
163 'mailing_id' => [
e501603b
TO
164 'name' => 'mailing_id',
165 'type' => CRM_Utils_Type::T_INT,
c3fc2621 166 'title' => ts('Mailing'),
215b423e 167 'description' => ts('The ID of the mailing this Job will send.'),
c3fc2621 168 'required' => TRUE,
a36434b9 169 'where' => 'civicrm_mailing_job.mailing_id',
522a26c9 170 'table_name' => 'civicrm_mailing_job',
171 'entity' => 'MailingJob',
172 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 173 'localizable' => 0,
e501603b 174 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
a9d0587b 175 'add' => NULL,
c3fc2621
CW
176 ],
177 'scheduled_date' => [
e501603b 178 'name' => 'scheduled_date',
6c2b97b7 179 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 180 'title' => ts('Mailing Scheduled Date'),
215b423e 181 'description' => ts('date on which this job was scheduled.'),
c3fc2621 182 'required' => FALSE,
a36434b9 183 'where' => 'civicrm_mailing_job.scheduled_date',
6c2b97b7 184 'default' => 'NULL',
522a26c9 185 'table_name' => 'civicrm_mailing_job',
186 'entity' => 'MailingJob',
187 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 188 'localizable' => 0,
2c2c4aa4 189 'html' => [
190 'type' => 'Select Date',
191 'formatType' => 'activityDateTime',
192 ],
a9d0587b 193 'add' => NULL,
c3fc2621 194 ],
de866a86 195 'mailing_job_start_date' => [
e501603b 196 'name' => 'start_date',
6c2b97b7 197 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 198 'title' => ts('Mailing Job Start Date'),
215b423e 199 'description' => ts('date on which this job was started.'),
c3fc2621 200 'required' => FALSE,
a36434b9 201 'where' => 'civicrm_mailing_job.start_date',
6c2b97b7 202 'default' => 'NULL',
522a26c9 203 'table_name' => 'civicrm_mailing_job',
204 'entity' => 'MailingJob',
205 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 206 'localizable' => 0,
de866a86 207 'unique_title' => ts('Mailing Start Date'),
2c2c4aa4 208 'html' => [
209 'type' => 'Select Date',
210 'formatType' => 'activityDateTime',
211 ],
a9d0587b 212 'add' => NULL,
c3fc2621
CW
213 ],
214 'end_date' => [
e501603b 215 'name' => 'end_date',
6c2b97b7 216 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 217 'title' => ts('Mailing Job End Date'),
215b423e 218 'description' => ts('date on which this job ended.'),
c3fc2621 219 'required' => FALSE,
a36434b9 220 'where' => 'civicrm_mailing_job.end_date',
6c2b97b7 221 'default' => 'NULL',
522a26c9 222 'table_name' => 'civicrm_mailing_job',
223 'entity' => 'MailingJob',
224 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 225 'localizable' => 0,
2c2c4aa4 226 'html' => [
227 'type' => 'Select Date',
228 'formatType' => 'activityDateTime',
229 ],
a9d0587b 230 'add' => NULL,
c3fc2621 231 ],
08d08c03 232 'mailing_job_status' => [
e501603b
TO
233 'name' => 'status',
234 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 235 'title' => ts('Mailing Job Status'),
215b423e 236 'description' => ts('The state of this job'),
e501603b
TO
237 'maxlength' => 12,
238 'size' => CRM_Utils_Type::TWELVE,
a36434b9 239 'where' => 'civicrm_mailing_job.status',
522a26c9 240 'table_name' => 'civicrm_mailing_job',
241 'entity' => 'MailingJob',
242 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 243 'localizable' => 0,
c3fc2621 244 'html' => [
e501603b 245 'type' => 'Select',
c3fc2621
CW
246 ],
247 'pseudoconstant' => [
e501603b 248 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
e6ca0a57 249 ],
a9d0587b 250 'add' => NULL,
c3fc2621
CW
251 ],
252 'is_test' => [
e501603b
TO
253 'name' => 'is_test',
254 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 255 'title' => ts('Mailing Job Is Test?'),
215b423e 256 'description' => ts('Is this job for a test mail?'),
a36434b9 257 'where' => 'civicrm_mailing_job.is_test',
45a83e42 258 'default' => '0',
522a26c9 259 'table_name' => 'civicrm_mailing_job',
260 'entity' => 'MailingJob',
261 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 262 'localizable' => 0,
a9d0587b 263 'add' => '1.9',
c3fc2621
CW
264 ],
265 'job_type' => [
e501603b
TO
266 'name' => 'job_type',
267 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 268 'title' => ts('Mailing Job Type'),
215b423e 269 'description' => ts('Type of mailling job: null | child '),
e501603b
TO
270 'maxlength' => 255,
271 'size' => CRM_Utils_Type::HUGE,
a36434b9 272 'where' => 'civicrm_mailing_job.job_type',
522a26c9 273 'table_name' => 'civicrm_mailing_job',
274 'entity' => 'MailingJob',
275 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 276 'localizable' => 0,
a9d0587b 277 'add' => '3.3',
c3fc2621
CW
278 ],
279 'parent_id' => [
e501603b
TO
280 'name' => 'parent_id',
281 'type' => CRM_Utils_Type::T_INT,
c3fc2621 282 'title' => ts('Mailing Job Parent'),
215b423e 283 'description' => ts('Parent job id'),
a36434b9 284 'where' => 'civicrm_mailing_job.parent_id',
e501603b 285 'default' => 'NULL',
522a26c9 286 'table_name' => 'civicrm_mailing_job',
287 'entity' => 'MailingJob',
288 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 289 'localizable' => 0,
e501603b 290 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
a9d0587b 291 'add' => '3.3',
c3fc2621
CW
292 ],
293 'job_offset' => [
e501603b
TO
294 'name' => 'job_offset',
295 'type' => CRM_Utils_Type::T_INT,
c3fc2621 296 'title' => ts('Mailing Job Offset'),
215b423e 297 'description' => ts('Offset of the child job'),
a36434b9 298 'where' => 'civicrm_mailing_job.job_offset',
45a83e42 299 'default' => '0',
522a26c9 300 'table_name' => 'civicrm_mailing_job',
301 'entity' => 'MailingJob',
302 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 303 'localizable' => 0,
a9d0587b 304 'add' => '3.3',
c3fc2621
CW
305 ],
306 'job_limit' => [
e501603b
TO
307 'name' => 'job_limit',
308 'type' => CRM_Utils_Type::T_INT,
c3fc2621 309 'title' => ts('Mailing Job Limit'),
215b423e 310 'description' => ts('Queue size limit for each child job'),
a36434b9 311 'where' => 'civicrm_mailing_job.job_limit',
45a83e42 312 'default' => '0',
522a26c9 313 'table_name' => 'civicrm_mailing_job',
314 'entity' => 'MailingJob',
315 'bao' => 'CRM_Mailing_BAO_MailingJob',
6a7e5e5d 316 'localizable' => 0,
a9d0587b 317 'add' => '3.3',
c3fc2621
CW
318 ],
319 ];
346aaaba 320 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 321 }
346aaaba 322 return Civi::$statics[__CLASS__]['fields'];
e501603b 323 }
c3fc2621 324
e501603b 325 /**
bd8e0b14 326 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
327 *
328 * @return array
bd8e0b14 329 * Array(string $name => string $uniqueName).
e501603b 330 */
c3fc2621 331 public static function &fieldKeys() {
bd8e0b14
TO
332 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
333 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 334 }
bd8e0b14 335 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 336 }
c3fc2621 337
e501603b
TO
338 /**
339 * Returns the names of this table
340 *
341 * @return string
342 */
c3fc2621 343 public static function getTableName() {
e501603b
TO
344 return self::$_tableName;
345 }
c3fc2621 346
e501603b
TO
347 /**
348 * Returns if this table needs to be logged
349 *
c3fc2621 350 * @return bool
e501603b 351 */
c3fc2621 352 public function getLog() {
e501603b
TO
353 return self::$_log;
354 }
c3fc2621 355
e501603b
TO
356 /**
357 * Returns the list of fields that can be imported
358 *
359 * @param bool $prefix
360 *
361 * @return array
362 */
c3fc2621
CW
363 public static function &import($prefix = FALSE) {
364 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, []);
60808919 365 return $r;
e501603b 366 }
c3fc2621 367
e501603b
TO
368 /**
369 * Returns the list of fields that can be exported
370 *
371 * @param bool $prefix
372 *
373 * @return array
374 */
c3fc2621
CW
375 public static function &export($prefix = FALSE) {
376 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, []);
60808919 377 return $r;
e501603b 378 }
c3fc2621 379
e7a6b91a
AS
380 /**
381 * Returns the list of indices
c3fc2621
CW
382 *
383 * @param bool $localize
384 *
385 * @return array
e7a6b91a
AS
386 */
387 public static function indices($localize = TRUE) {
c3fc2621 388 $indices = [];
e7a6b91a
AS
389 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
390 }
c3fc2621 391
e501603b 392}