Commit | Line | Data |
---|---|---|
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 | |
28979d65 | 9 | * (GenCodeChecksum:fdca7fda2701c59049924abfdb6adf3b) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the MailingJob entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class 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 | * | |
28979d65 CW |
89 | * @var bool|string|null |
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?'), |
a36434b9 | 286 | 'where' => 'civicrm_mailing_job.is_test', |
45a83e42 | 287 | 'default' => '0', |
522a26c9 | 288 | 'table_name' => 'civicrm_mailing_job', |
289 | 'entity' => 'MailingJob', | |
290 | 'bao' => 'CRM_Mailing_BAO_MailingJob', | |
6a7e5e5d | 291 | 'localizable' => 0, |
a9d0587b | 292 | 'add' => '1.9', |
c3fc2621 CW |
293 | ], |
294 | 'job_type' => [ | |
e501603b TO |
295 | 'name' => 'job_type', |
296 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 297 | 'title' => ts('Mailing Job Type'), |
215b423e | 298 | 'description' => ts('Type of mailling job: null | child '), |
e501603b TO |
299 | 'maxlength' => 255, |
300 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 301 | 'where' => 'civicrm_mailing_job.job_type', |
522a26c9 | 302 | 'table_name' => 'civicrm_mailing_job', |
303 | 'entity' => 'MailingJob', | |
304 | 'bao' => 'CRM_Mailing_BAO_MailingJob', | |
6a7e5e5d | 305 | 'localizable' => 0, |
a9d0587b | 306 | 'add' => '3.3', |
c3fc2621 CW |
307 | ], |
308 | 'parent_id' => [ | |
e501603b TO |
309 | 'name' => 'parent_id', |
310 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 311 | 'title' => ts('Parent ID'), |
215b423e | 312 | 'description' => ts('Parent job id'), |
a36434b9 | 313 | 'where' => 'civicrm_mailing_job.parent_id', |
5fb0de1f | 314 | 'default' => NULL, |
522a26c9 | 315 | 'table_name' => 'civicrm_mailing_job', |
316 | 'entity' => 'MailingJob', | |
317 | 'bao' => 'CRM_Mailing_BAO_MailingJob', | |
6a7e5e5d | 318 | 'localizable' => 0, |
e501603b | 319 | 'FKClassName' => 'CRM_Mailing_DAO_MailingJob', |
2cbbebe8 A |
320 | 'html' => [ |
321 | 'label' => ts("Parent"), | |
322 | ], | |
a9d0587b | 323 | 'add' => '3.3', |
c3fc2621 CW |
324 | ], |
325 | 'job_offset' => [ | |
e501603b TO |
326 | 'name' => 'job_offset', |
327 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 328 | 'title' => ts('Mailing Job Offset'), |
215b423e | 329 | 'description' => ts('Offset of the child job'), |
a36434b9 | 330 | 'where' => 'civicrm_mailing_job.job_offset', |
45a83e42 | 331 | 'default' => '0', |
522a26c9 | 332 | 'table_name' => 'civicrm_mailing_job', |
333 | 'entity' => 'MailingJob', | |
334 | 'bao' => 'CRM_Mailing_BAO_MailingJob', | |
6a7e5e5d | 335 | 'localizable' => 0, |
a9d0587b | 336 | 'add' => '3.3', |
c3fc2621 CW |
337 | ], |
338 | 'job_limit' => [ | |
e501603b TO |
339 | 'name' => 'job_limit', |
340 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 341 | 'title' => ts('Mailing Job Limit'), |
215b423e | 342 | 'description' => ts('Queue size limit for each child job'), |
a36434b9 | 343 | 'where' => 'civicrm_mailing_job.job_limit', |
45a83e42 | 344 | 'default' => '0', |
522a26c9 | 345 | 'table_name' => 'civicrm_mailing_job', |
346 | 'entity' => 'MailingJob', | |
347 | 'bao' => 'CRM_Mailing_BAO_MailingJob', | |
6a7e5e5d | 348 | 'localizable' => 0, |
a9d0587b | 349 | 'add' => '3.3', |
c3fc2621 CW |
350 | ], |
351 | ]; | |
346aaaba | 352 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 353 | } |
346aaaba | 354 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 355 | } |
c3fc2621 | 356 | |
e501603b | 357 | /** |
bd8e0b14 | 358 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
359 | * |
360 | * @return array | |
bd8e0b14 | 361 | * Array(string $name => string $uniqueName). |
e501603b | 362 | */ |
c3fc2621 | 363 | public static function &fieldKeys() { |
bd8e0b14 TO |
364 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
365 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 366 | } |
bd8e0b14 | 367 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 368 | } |
c3fc2621 | 369 | |
e501603b TO |
370 | /** |
371 | * Returns the names of this table | |
372 | * | |
373 | * @return string | |
374 | */ | |
c3fc2621 | 375 | public static function getTableName() { |
e501603b TO |
376 | return self::$_tableName; |
377 | } | |
c3fc2621 | 378 | |
e501603b TO |
379 | /** |
380 | * Returns if this table needs to be logged | |
381 | * | |
c3fc2621 | 382 | * @return bool |
e501603b | 383 | */ |
c3fc2621 | 384 | public function getLog() { |
e501603b TO |
385 | return self::$_log; |
386 | } | |
c3fc2621 | 387 | |
e501603b TO |
388 | /** |
389 | * Returns the list of fields that can be imported | |
390 | * | |
391 | * @param bool $prefix | |
392 | * | |
393 | * @return array | |
394 | */ | |
c3fc2621 CW |
395 | public static function &import($prefix = FALSE) { |
396 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, []); | |
60808919 | 397 | return $r; |
e501603b | 398 | } |
c3fc2621 | 399 | |
e501603b TO |
400 | /** |
401 | * Returns the list of fields that can be exported | |
402 | * | |
403 | * @param bool $prefix | |
404 | * | |
405 | * @return array | |
406 | */ | |
c3fc2621 CW |
407 | public static function &export($prefix = FALSE) { |
408 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, []); | |
60808919 | 409 | return $r; |
e501603b | 410 | } |
c3fc2621 | 411 | |
e7a6b91a AS |
412 | /** |
413 | * Returns the list of indices | |
c3fc2621 CW |
414 | * |
415 | * @param bool $localize | |
416 | * | |
417 | * @return array | |
e7a6b91a AS |
418 | */ |
419 | public static function indices($localize = TRUE) { | |
c3fc2621 | 420 | $indices = []; |
e7a6b91a AS |
421 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
422 | } | |
c3fc2621 | 423 | |
e501603b | 424 | } |