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