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/Core/Job.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
28979d65 | 9 | * (GenCodeChecksum:75ec772bec625c1d315df0abadd2fca6) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Job entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_Job extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '4.1'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_job'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = FALSE; |
c3fc2621 | 32 | |
e501603b | 33 | /** |
2cbbebe8 | 34 | * Job ID |
e501603b | 35 | * |
28979d65 CW |
36 | * @var int|string|null |
37 | * (SQL type: int unsigned) | |
38 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
39 | */ |
40 | public $id; | |
c3fc2621 | 41 | |
e501603b TO |
42 | /** |
43 | * Which Domain is this scheduled job for | |
44 | * | |
28979d65 CW |
45 | * @var int|string |
46 | * (SQL type: int unsigned) | |
47 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
48 | */ |
49 | public $domain_id; | |
c3fc2621 | 50 | |
e501603b TO |
51 | /** |
52 | * Scheduled job run frequency. | |
53 | * | |
28979d65 CW |
54 | * @var string|null |
55 | * (SQL type: varchar(8)) | |
56 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
57 | */ |
58 | public $run_frequency; | |
c3fc2621 | 59 | |
e501603b TO |
60 | /** |
61 | * When was this cron entry last run | |
62 | * | |
28979d65 CW |
63 | * @var string |
64 | * (SQL type: timestamp) | |
65 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
66 | */ |
67 | public $last_run; | |
c3fc2621 | 68 | |
e501603b TO |
69 | /** |
70 | * When is this cron entry scheduled to run | |
71 | * | |
28979d65 CW |
72 | * @var string |
73 | * (SQL type: timestamp) | |
74 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
75 | */ |
76 | public $scheduled_run_date; | |
c3fc2621 | 77 | |
e501603b TO |
78 | /** |
79 | * Title of the job | |
80 | * | |
28979d65 CW |
81 | * @var string|null |
82 | * (SQL type: varchar(255)) | |
83 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
84 | */ |
85 | public $name; | |
c3fc2621 | 86 | |
e501603b TO |
87 | /** |
88 | * Description of the job | |
89 | * | |
28979d65 CW |
90 | * @var string|null |
91 | * (SQL type: varchar(255)) | |
92 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
93 | */ |
94 | public $description; | |
c3fc2621 | 95 | |
e501603b TO |
96 | /** |
97 | * Entity of the job api call | |
98 | * | |
28979d65 CW |
99 | * @var string|null |
100 | * (SQL type: varchar(255)) | |
101 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
102 | */ |
103 | public $api_entity; | |
c3fc2621 | 104 | |
e501603b TO |
105 | /** |
106 | * Action of the job api call | |
107 | * | |
28979d65 CW |
108 | * @var string|null |
109 | * (SQL type: varchar(255)) | |
110 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
111 | */ |
112 | public $api_action; | |
c3fc2621 | 113 | |
e501603b TO |
114 | /** |
115 | * List of parameters to the command. | |
116 | * | |
28979d65 CW |
117 | * @var string|null |
118 | * (SQL type: text) | |
119 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
120 | */ |
121 | public $parameters; | |
c3fc2621 | 122 | |
e501603b TO |
123 | /** |
124 | * Is this job active? | |
125 | * | |
28979d65 CW |
126 | * @var bool|string|null |
127 | * (SQL type: tinyint) | |
128 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
129 | */ |
130 | public $is_active; | |
c3fc2621 | 131 | |
e501603b | 132 | /** |
f41f0342 | 133 | * Class constructor. |
e501603b | 134 | */ |
c3fc2621 | 135 | public function __construct() { |
e501603b TO |
136 | $this->__table = 'civicrm_job'; |
137 | parent::__construct(); | |
138 | } | |
c3fc2621 | 139 | |
449c4e6b CW |
140 | /** |
141 | * Returns localized title of this entity. | |
7b66c3b5 AH |
142 | * |
143 | * @param bool $plural | |
144 | * Whether to return the plural version of the title. | |
449c4e6b | 145 | */ |
7b66c3b5 AH |
146 | public static function getEntityTitle($plural = FALSE) { |
147 | return $plural ? ts('Jobs') : ts('Job'); | |
449c4e6b CW |
148 | } |
149 | ||
e501603b | 150 | /** |
f41f0342 | 151 | * Returns foreign keys and entity references. |
e501603b TO |
152 | * |
153 | * @return array | |
154 | * [CRM_Core_Reference_Interface] | |
155 | */ | |
c3fc2621 | 156 | public static function getReferenceColumns() { |
346aaaba | 157 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 158 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 159 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', '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 | 176 | 'title' => ts('Job ID'), |
2cbbebe8 | 177 | 'description' => ts('Job ID'), |
c3fc2621 | 178 | 'required' => TRUE, |
a36434b9 | 179 | 'where' => 'civicrm_job.id', |
522a26c9 | 180 | 'table_name' => 'civicrm_job', |
181 | 'entity' => 'Job', | |
182 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 183 | 'localizable' => 0, |
2cbbebe8 A |
184 | 'html' => [ |
185 | 'type' => 'Number', | |
186 | ], | |
1fe423d6 | 187 | 'readonly' => TRUE, |
a9d0587b | 188 | 'add' => '4.1', |
c3fc2621 CW |
189 | ], |
190 | 'domain_id' => [ | |
e501603b TO |
191 | 'name' => 'domain_id', |
192 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 193 | 'title' => ts('Domain ID'), |
215b423e | 194 | 'description' => ts('Which Domain is this scheduled job for'), |
c3fc2621 | 195 | 'required' => TRUE, |
a36434b9 | 196 | 'where' => 'civicrm_job.domain_id', |
522a26c9 | 197 | 'table_name' => 'civicrm_job', |
198 | 'entity' => 'Job', | |
199 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 200 | 'localizable' => 0, |
e501603b | 201 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
2cbbebe8 A |
202 | 'html' => [ |
203 | 'label' => ts("Domain"), | |
204 | ], | |
c3fc2621 | 205 | 'pseudoconstant' => [ |
e501603b TO |
206 | 'table' => 'civicrm_domain', |
207 | 'keyColumn' => 'id', | |
208 | 'labelColumn' => 'name', | |
e6ca0a57 | 209 | ], |
a9d0587b | 210 | 'add' => '4.1', |
c3fc2621 CW |
211 | ], |
212 | 'run_frequency' => [ | |
e501603b TO |
213 | 'name' => 'run_frequency', |
214 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 215 | 'title' => ts('Job Frequency'), |
215b423e | 216 | 'description' => ts('Scheduled job run frequency.'), |
e501603b TO |
217 | 'maxlength' => 8, |
218 | 'size' => CRM_Utils_Type::EIGHT, | |
a36434b9 | 219 | 'where' => 'civicrm_job.run_frequency', |
e501603b | 220 | 'default' => 'Daily', |
522a26c9 | 221 | 'table_name' => 'civicrm_job', |
222 | 'entity' => 'Job', | |
223 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 224 | 'localizable' => 0, |
c3fc2621 | 225 | 'html' => [ |
e501603b | 226 | 'type' => 'Select', |
c3fc2621 CW |
227 | ], |
228 | 'pseudoconstant' => [ | |
e501603b | 229 | 'callback' => 'CRM_Core_SelectValues::getJobFrequency', |
e6ca0a57 | 230 | ], |
a9d0587b | 231 | 'add' => '4.1', |
c3fc2621 CW |
232 | ], |
233 | 'last_run' => [ | |
e501603b | 234 | 'name' => 'last_run', |
6c2b97b7 | 235 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
c3fc2621 | 236 | 'title' => ts('Last Run'), |
215b423e | 237 | 'description' => ts('When was this cron entry last run'), |
c3fc2621 | 238 | 'required' => FALSE, |
a36434b9 | 239 | 'where' => 'civicrm_job.last_run', |
5fb0de1f | 240 | 'default' => NULL, |
522a26c9 | 241 | 'table_name' => 'civicrm_job', |
242 | 'entity' => 'Job', | |
243 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 244 | 'localizable' => 0, |
c23563e3 SL |
245 | 'html' => [ |
246 | 'label' => ts("Last Run"), | |
247 | ], | |
a9d0587b | 248 | 'add' => '4.1', |
c3fc2621 CW |
249 | ], |
250 | 'scheduled_run_date' => [ | |
e501603b TO |
251 | 'name' => 'scheduled_run_date', |
252 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 253 | 'title' => ts('Scheduled Run Date'), |
215b423e | 254 | 'description' => ts('When is this cron entry scheduled to run'), |
c3fc2621 | 255 | 'required' => FALSE, |
a36434b9 | 256 | 'where' => 'civicrm_job.scheduled_run_date', |
5fb0de1f | 257 | 'default' => NULL, |
522a26c9 | 258 | 'table_name' => 'civicrm_job', |
259 | 'entity' => 'Job', | |
260 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 261 | 'localizable' => 0, |
c23563e3 SL |
262 | 'html' => [ |
263 | 'label' => ts("Scheduled Run Date"), | |
264 | ], | |
a9d0587b | 265 | 'add' => '4.7', |
c3fc2621 CW |
266 | ], |
267 | 'name' => [ | |
e501603b TO |
268 | 'name' => 'name', |
269 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 270 | 'title' => ts('Job Name'), |
215b423e | 271 | 'description' => ts('Title of the job'), |
e501603b TO |
272 | 'maxlength' => 255, |
273 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 274 | 'where' => 'civicrm_job.name', |
522a26c9 | 275 | 'table_name' => 'civicrm_job', |
276 | 'entity' => 'Job', | |
277 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 278 | 'localizable' => 0, |
a9d0587b | 279 | 'add' => '4.1', |
c3fc2621 CW |
280 | ], |
281 | 'description' => [ | |
e501603b TO |
282 | 'name' => 'description', |
283 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 284 | 'title' => ts('Job Description'), |
215b423e | 285 | 'description' => ts('Description of the job'), |
e501603b TO |
286 | 'maxlength' => 255, |
287 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 288 | 'where' => 'civicrm_job.description', |
522a26c9 | 289 | 'table_name' => 'civicrm_job', |
290 | 'entity' => 'Job', | |
291 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 292 | 'localizable' => 0, |
a9d0587b | 293 | 'add' => '4.1', |
c3fc2621 CW |
294 | ], |
295 | 'api_entity' => [ | |
e501603b TO |
296 | 'name' => 'api_entity', |
297 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 298 | 'title' => ts('API Entity'), |
215b423e | 299 | 'description' => ts('Entity of the job api call'), |
e501603b TO |
300 | 'maxlength' => 255, |
301 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 302 | 'where' => 'civicrm_job.api_entity', |
522a26c9 | 303 | 'table_name' => 'civicrm_job', |
304 | 'entity' => 'Job', | |
305 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 306 | 'localizable' => 0, |
a9d0587b | 307 | 'add' => '4.1', |
c3fc2621 CW |
308 | ], |
309 | 'api_action' => [ | |
e501603b TO |
310 | 'name' => 'api_action', |
311 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 312 | 'title' => ts('API Action'), |
215b423e | 313 | 'description' => ts('Action of the job api call'), |
e501603b TO |
314 | 'maxlength' => 255, |
315 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 316 | 'where' => 'civicrm_job.api_action', |
522a26c9 | 317 | 'table_name' => 'civicrm_job', |
318 | 'entity' => 'Job', | |
319 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 320 | 'localizable' => 0, |
a9d0587b | 321 | 'add' => '4.1', |
c3fc2621 CW |
322 | ], |
323 | 'parameters' => [ | |
e501603b TO |
324 | 'name' => 'parameters', |
325 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 326 | 'title' => ts('API Parameters'), |
215b423e | 327 | 'description' => ts('List of parameters to the command.'), |
e501603b TO |
328 | 'rows' => 4, |
329 | 'cols' => 60, | |
a36434b9 | 330 | 'where' => 'civicrm_job.parameters', |
522a26c9 | 331 | 'table_name' => 'civicrm_job', |
332 | 'entity' => 'Job', | |
333 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 334 | 'localizable' => 0, |
c3fc2621 | 335 | 'html' => [ |
e501603b | 336 | 'type' => 'TextArea', |
c3fc2621 | 337 | ], |
a9d0587b | 338 | 'add' => '4.1', |
c3fc2621 CW |
339 | ], |
340 | 'is_active' => [ | |
e501603b TO |
341 | 'name' => 'is_active', |
342 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 343 | 'title' => ts('Job Is Active?'), |
215b423e | 344 | 'description' => ts('Is this job active?'), |
a36434b9 | 345 | 'where' => 'civicrm_job.is_active', |
522a26c9 | 346 | 'table_name' => 'civicrm_job', |
347 | 'entity' => 'Job', | |
348 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 349 | 'localizable' => 0, |
a9d0587b | 350 | 'add' => '4.1', |
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__, '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__, '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 | } |