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 | |
929a1c14 | 9 | * (GenCodeChecksum:6e3a5de515fda550b1b5aeb493c50f0b) |
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 TO |
33 | /** |
34 | * Job Id | |
35 | * | |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Which Domain is this scheduled job for | |
42 | * | |
e6ca0a57 | 43 | * @var int |
e501603b TO |
44 | */ |
45 | public $domain_id; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * Scheduled job run frequency. | |
49 | * | |
50 | * @var string | |
51 | */ | |
52 | public $run_frequency; | |
c3fc2621 | 53 | |
e501603b TO |
54 | /** |
55 | * When was this cron entry last run | |
56 | * | |
6c2b97b7 | 57 | * @var timestamp |
e501603b TO |
58 | */ |
59 | public $last_run; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * When is this cron entry scheduled to run | |
63 | * | |
64 | * @var timestamp | |
65 | */ | |
66 | public $scheduled_run_date; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * Title of the job | |
70 | * | |
71 | * @var string | |
72 | */ | |
73 | public $name; | |
c3fc2621 | 74 | |
e501603b TO |
75 | /** |
76 | * Description of the job | |
77 | * | |
78 | * @var string | |
79 | */ | |
80 | public $description; | |
c3fc2621 | 81 | |
e501603b TO |
82 | /** |
83 | * Entity of the job api call | |
84 | * | |
85 | * @var string | |
86 | */ | |
87 | public $api_entity; | |
c3fc2621 | 88 | |
e501603b TO |
89 | /** |
90 | * Action of the job api call | |
91 | * | |
92 | * @var string | |
93 | */ | |
94 | public $api_action; | |
c3fc2621 | 95 | |
e501603b TO |
96 | /** |
97 | * List of parameters to the command. | |
98 | * | |
99 | * @var text | |
100 | */ | |
101 | public $parameters; | |
c3fc2621 | 102 | |
e501603b TO |
103 | /** |
104 | * Is this job active? | |
105 | * | |
e6ca0a57 | 106 | * @var bool |
e501603b TO |
107 | */ |
108 | public $is_active; | |
c3fc2621 | 109 | |
e501603b | 110 | /** |
f41f0342 | 111 | * Class constructor. |
e501603b | 112 | */ |
c3fc2621 | 113 | public function __construct() { |
e501603b TO |
114 | $this->__table = 'civicrm_job'; |
115 | parent::__construct(); | |
116 | } | |
c3fc2621 | 117 | |
449c4e6b CW |
118 | /** |
119 | * Returns localized title of this entity. | |
120 | */ | |
121 | public static function getEntityTitle() { | |
122 | return ts('Jobs'); | |
123 | } | |
124 | ||
e501603b | 125 | /** |
f41f0342 | 126 | * Returns foreign keys and entity references. |
e501603b TO |
127 | * |
128 | * @return array | |
129 | * [CRM_Core_Reference_Interface] | |
130 | */ | |
c3fc2621 | 131 | public static function getReferenceColumns() { |
346aaaba | 132 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 133 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 134 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
346aaaba | 135 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 136 | } |
346aaaba | 137 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 138 | } |
c3fc2621 | 139 | |
e501603b TO |
140 | /** |
141 | * Returns all the column names of this table | |
142 | * | |
143 | * @return array | |
144 | */ | |
c3fc2621 | 145 | public static function &fields() { |
346aaaba | 146 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
147 | Civi::$statics[__CLASS__]['fields'] = [ |
148 | 'id' => [ | |
e501603b TO |
149 | 'name' => 'id', |
150 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 151 | 'title' => ts('Job ID'), |
215b423e | 152 | 'description' => ts('Job Id'), |
c3fc2621 | 153 | 'required' => TRUE, |
a36434b9 | 154 | 'where' => 'civicrm_job.id', |
522a26c9 | 155 | 'table_name' => 'civicrm_job', |
156 | 'entity' => 'Job', | |
157 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 158 | 'localizable' => 0, |
a9d0587b | 159 | 'add' => '4.1', |
c3fc2621 CW |
160 | ], |
161 | 'domain_id' => [ | |
e501603b TO |
162 | 'name' => 'domain_id', |
163 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 164 | 'title' => ts('Job Domain'), |
215b423e | 165 | 'description' => ts('Which Domain is this scheduled job for'), |
c3fc2621 | 166 | 'required' => TRUE, |
a36434b9 | 167 | 'where' => 'civicrm_job.domain_id', |
522a26c9 | 168 | 'table_name' => 'civicrm_job', |
169 | 'entity' => 'Job', | |
170 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 171 | 'localizable' => 0, |
e501603b | 172 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 173 | 'pseudoconstant' => [ |
e501603b TO |
174 | 'table' => 'civicrm_domain', |
175 | 'keyColumn' => 'id', | |
176 | 'labelColumn' => 'name', | |
e6ca0a57 | 177 | ], |
a9d0587b | 178 | 'add' => '4.1', |
c3fc2621 CW |
179 | ], |
180 | 'run_frequency' => [ | |
e501603b TO |
181 | 'name' => 'run_frequency', |
182 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 183 | 'title' => ts('Job Frequency'), |
215b423e | 184 | 'description' => ts('Scheduled job run frequency.'), |
e501603b TO |
185 | 'maxlength' => 8, |
186 | 'size' => CRM_Utils_Type::EIGHT, | |
a36434b9 | 187 | 'where' => 'civicrm_job.run_frequency', |
e501603b | 188 | 'default' => 'Daily', |
522a26c9 | 189 | 'table_name' => 'civicrm_job', |
190 | 'entity' => 'Job', | |
191 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 192 | 'localizable' => 0, |
c3fc2621 | 193 | 'html' => [ |
e501603b | 194 | 'type' => 'Select', |
c3fc2621 CW |
195 | ], |
196 | 'pseudoconstant' => [ | |
e501603b | 197 | 'callback' => 'CRM_Core_SelectValues::getJobFrequency', |
e6ca0a57 | 198 | ], |
a9d0587b | 199 | 'add' => '4.1', |
c3fc2621 CW |
200 | ], |
201 | 'last_run' => [ | |
e501603b | 202 | 'name' => 'last_run', |
6c2b97b7 | 203 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
c3fc2621 | 204 | 'title' => ts('Last Run'), |
215b423e | 205 | 'description' => ts('When was this cron entry last run'), |
c3fc2621 | 206 | 'required' => FALSE, |
a36434b9 | 207 | 'where' => 'civicrm_job.last_run', |
e501603b | 208 | 'default' => 'NULL', |
522a26c9 | 209 | 'table_name' => 'civicrm_job', |
210 | 'entity' => 'Job', | |
211 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 212 | 'localizable' => 0, |
a9d0587b | 213 | 'add' => '4.1', |
c3fc2621 CW |
214 | ], |
215 | 'scheduled_run_date' => [ | |
e501603b TO |
216 | 'name' => 'scheduled_run_date', |
217 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 218 | 'title' => ts('Scheduled Run Date'), |
215b423e | 219 | 'description' => ts('When is this cron entry scheduled to run'), |
c3fc2621 | 220 | 'required' => FALSE, |
a36434b9 | 221 | 'where' => 'civicrm_job.scheduled_run_date', |
e501603b | 222 | 'default' => 'NULL', |
522a26c9 | 223 | 'table_name' => 'civicrm_job', |
224 | 'entity' => 'Job', | |
225 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 226 | 'localizable' => 0, |
a9d0587b | 227 | 'add' => '4.7', |
c3fc2621 CW |
228 | ], |
229 | 'name' => [ | |
e501603b TO |
230 | 'name' => 'name', |
231 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 232 | 'title' => ts('Job Name'), |
215b423e | 233 | 'description' => ts('Title of the job'), |
e501603b TO |
234 | 'maxlength' => 255, |
235 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 236 | 'where' => 'civicrm_job.name', |
522a26c9 | 237 | 'table_name' => 'civicrm_job', |
238 | 'entity' => 'Job', | |
239 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 240 | 'localizable' => 0, |
a9d0587b | 241 | 'add' => '4.1', |
c3fc2621 CW |
242 | ], |
243 | 'description' => [ | |
e501603b TO |
244 | 'name' => 'description', |
245 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 246 | 'title' => ts('Job Description'), |
215b423e | 247 | 'description' => ts('Description of the job'), |
e501603b TO |
248 | 'maxlength' => 255, |
249 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 250 | 'where' => 'civicrm_job.description', |
522a26c9 | 251 | 'table_name' => 'civicrm_job', |
252 | 'entity' => 'Job', | |
253 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 254 | 'localizable' => 0, |
a9d0587b | 255 | 'add' => '4.1', |
c3fc2621 CW |
256 | ], |
257 | 'api_entity' => [ | |
e501603b TO |
258 | 'name' => 'api_entity', |
259 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 260 | 'title' => ts('API Entity'), |
215b423e | 261 | 'description' => ts('Entity of the job api call'), |
e501603b TO |
262 | 'maxlength' => 255, |
263 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 264 | 'where' => 'civicrm_job.api_entity', |
522a26c9 | 265 | 'table_name' => 'civicrm_job', |
266 | 'entity' => 'Job', | |
267 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 268 | 'localizable' => 0, |
a9d0587b | 269 | 'add' => '4.1', |
c3fc2621 CW |
270 | ], |
271 | 'api_action' => [ | |
e501603b TO |
272 | 'name' => 'api_action', |
273 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 274 | 'title' => ts('API Action'), |
215b423e | 275 | 'description' => ts('Action of the job api call'), |
e501603b TO |
276 | 'maxlength' => 255, |
277 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 278 | 'where' => 'civicrm_job.api_action', |
522a26c9 | 279 | 'table_name' => 'civicrm_job', |
280 | 'entity' => 'Job', | |
281 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 282 | 'localizable' => 0, |
a9d0587b | 283 | 'add' => '4.1', |
c3fc2621 CW |
284 | ], |
285 | 'parameters' => [ | |
e501603b TO |
286 | 'name' => 'parameters', |
287 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 288 | 'title' => ts('API Parameters'), |
215b423e | 289 | 'description' => ts('List of parameters to the command.'), |
e501603b TO |
290 | 'rows' => 4, |
291 | 'cols' => 60, | |
a36434b9 | 292 | 'where' => 'civicrm_job.parameters', |
522a26c9 | 293 | 'table_name' => 'civicrm_job', |
294 | 'entity' => 'Job', | |
295 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 296 | 'localizable' => 0, |
c3fc2621 | 297 | 'html' => [ |
e501603b | 298 | 'type' => 'TextArea', |
c3fc2621 | 299 | ], |
a9d0587b | 300 | 'add' => '4.1', |
c3fc2621 CW |
301 | ], |
302 | 'is_active' => [ | |
e501603b TO |
303 | 'name' => 'is_active', |
304 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 305 | 'title' => ts('Job Is Active?'), |
215b423e | 306 | 'description' => ts('Is this job active?'), |
a36434b9 | 307 | 'where' => 'civicrm_job.is_active', |
522a26c9 | 308 | 'table_name' => 'civicrm_job', |
309 | 'entity' => 'Job', | |
310 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 311 | 'localizable' => 0, |
a9d0587b | 312 | 'add' => '4.1', |
c3fc2621 CW |
313 | ], |
314 | ]; | |
346aaaba | 315 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 316 | } |
346aaaba | 317 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 318 | } |
c3fc2621 | 319 | |
e501603b | 320 | /** |
bd8e0b14 | 321 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
322 | * |
323 | * @return array | |
bd8e0b14 | 324 | * Array(string $name => string $uniqueName). |
e501603b | 325 | */ |
c3fc2621 | 326 | public static function &fieldKeys() { |
bd8e0b14 TO |
327 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
328 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 329 | } |
bd8e0b14 | 330 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 331 | } |
c3fc2621 | 332 | |
e501603b TO |
333 | /** |
334 | * Returns the names of this table | |
335 | * | |
336 | * @return string | |
337 | */ | |
c3fc2621 | 338 | public static function getTableName() { |
e501603b TO |
339 | return self::$_tableName; |
340 | } | |
c3fc2621 | 341 | |
e501603b TO |
342 | /** |
343 | * Returns if this table needs to be logged | |
344 | * | |
c3fc2621 | 345 | * @return bool |
e501603b | 346 | */ |
c3fc2621 | 347 | public function getLog() { |
e501603b TO |
348 | return self::$_log; |
349 | } | |
c3fc2621 | 350 | |
e501603b TO |
351 | /** |
352 | * Returns the list of fields that can be imported | |
353 | * | |
354 | * @param bool $prefix | |
355 | * | |
356 | * @return array | |
357 | */ | |
c3fc2621 CW |
358 | public static function &import($prefix = FALSE) { |
359 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, []); | |
60808919 | 360 | return $r; |
e501603b | 361 | } |
c3fc2621 | 362 | |
e501603b TO |
363 | /** |
364 | * Returns the list of fields that can be exported | |
365 | * | |
366 | * @param bool $prefix | |
367 | * | |
368 | * @return array | |
369 | */ | |
c3fc2621 CW |
370 | public static function &export($prefix = FALSE) { |
371 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, []); | |
60808919 | 372 | return $r; |
e501603b | 373 | } |
c3fc2621 | 374 | |
e7a6b91a AS |
375 | /** |
376 | * Returns the list of indices | |
c3fc2621 CW |
377 | * |
378 | * @param bool $localize | |
379 | * | |
380 | * @return array | |
e7a6b91a AS |
381 | */ |
382 | public static function indices($localize = TRUE) { | |
c3fc2621 | 383 | $indices = []; |
e7a6b91a AS |
384 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
385 | } | |
c3fc2621 | 386 | |
e501603b | 387 | } |