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