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