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