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/Core/Job.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e380ee3b | 9 | * (GenCodeChecksum:6a87295b587fb722d7b2026e2f2dbfe7) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = FALSE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Job Id | |
33 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Which Domain is this scheduled job for | |
40 | * | |
41 | * @var int unsigned | |
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 | * | |
104 | * @var boolean | |
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 TO |
123 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
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, |
522a26c9 | 145 | 'table_name' => 'civicrm_job', |
146 | 'entity' => 'Job', | |
147 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 148 | 'localizable' => 0, |
c3fc2621 CW |
149 | ], |
150 | 'domain_id' => [ | |
e501603b TO |
151 | 'name' => 'domain_id', |
152 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 153 | 'title' => ts('Job Domain'), |
215b423e | 154 | 'description' => ts('Which Domain is this scheduled job for'), |
c3fc2621 | 155 | 'required' => TRUE, |
522a26c9 | 156 | 'table_name' => 'civicrm_job', |
157 | 'entity' => 'Job', | |
158 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 159 | 'localizable' => 0, |
e501603b | 160 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 161 | 'pseudoconstant' => [ |
e501603b TO |
162 | 'table' => 'civicrm_domain', |
163 | 'keyColumn' => 'id', | |
164 | 'labelColumn' => 'name', | |
c3fc2621 CW |
165 | ] |
166 | ], | |
167 | 'run_frequency' => [ | |
e501603b TO |
168 | 'name' => 'run_frequency', |
169 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 170 | 'title' => ts('Job Frequency'), |
215b423e | 171 | 'description' => ts('Scheduled job run frequency.'), |
e501603b TO |
172 | 'maxlength' => 8, |
173 | 'size' => CRM_Utils_Type::EIGHT, | |
174 | 'default' => 'Daily', | |
522a26c9 | 175 | 'table_name' => 'civicrm_job', |
176 | 'entity' => 'Job', | |
177 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 178 | 'localizable' => 0, |
c3fc2621 | 179 | 'html' => [ |
e501603b | 180 | 'type' => 'Select', |
c3fc2621 CW |
181 | ], |
182 | 'pseudoconstant' => [ | |
e501603b | 183 | 'callback' => 'CRM_Core_SelectValues::getJobFrequency', |
c3fc2621 CW |
184 | ] |
185 | ], | |
186 | 'last_run' => [ | |
e501603b | 187 | 'name' => 'last_run', |
6c2b97b7 | 188 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
c3fc2621 | 189 | 'title' => ts('Last Run'), |
215b423e | 190 | 'description' => ts('When was this cron entry last run'), |
c3fc2621 | 191 | 'required' => FALSE, |
e501603b | 192 | 'default' => 'NULL', |
522a26c9 | 193 | 'table_name' => 'civicrm_job', |
194 | 'entity' => 'Job', | |
195 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 196 | 'localizable' => 0, |
c3fc2621 CW |
197 | ], |
198 | 'scheduled_run_date' => [ | |
e501603b TO |
199 | 'name' => 'scheduled_run_date', |
200 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
c3fc2621 | 201 | 'title' => ts('Scheduled Run Date'), |
215b423e | 202 | 'description' => ts('When is this cron entry scheduled to run'), |
c3fc2621 | 203 | 'required' => FALSE, |
e501603b | 204 | 'default' => 'NULL', |
522a26c9 | 205 | 'table_name' => 'civicrm_job', |
206 | 'entity' => 'Job', | |
207 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 208 | 'localizable' => 0, |
c3fc2621 CW |
209 | ], |
210 | 'name' => [ | |
e501603b TO |
211 | 'name' => 'name', |
212 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 213 | 'title' => ts('Job Name'), |
215b423e | 214 | 'description' => ts('Title of the job'), |
e501603b TO |
215 | 'maxlength' => 255, |
216 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 217 | 'table_name' => 'civicrm_job', |
218 | 'entity' => 'Job', | |
219 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 220 | 'localizable' => 0, |
c3fc2621 CW |
221 | ], |
222 | 'description' => [ | |
e501603b TO |
223 | 'name' => 'description', |
224 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 225 | 'title' => ts('Job Description'), |
215b423e | 226 | 'description' => ts('Description of the job'), |
e501603b TO |
227 | 'maxlength' => 255, |
228 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 229 | 'table_name' => 'civicrm_job', |
230 | 'entity' => 'Job', | |
231 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 232 | 'localizable' => 0, |
c3fc2621 CW |
233 | ], |
234 | 'api_entity' => [ | |
e501603b TO |
235 | 'name' => 'api_entity', |
236 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 237 | 'title' => ts('API Entity'), |
215b423e | 238 | 'description' => ts('Entity of the job api call'), |
e501603b TO |
239 | 'maxlength' => 255, |
240 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 241 | 'table_name' => 'civicrm_job', |
242 | 'entity' => 'Job', | |
243 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 244 | 'localizable' => 0, |
c3fc2621 CW |
245 | ], |
246 | 'api_action' => [ | |
e501603b TO |
247 | 'name' => 'api_action', |
248 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 249 | 'title' => ts('API Action'), |
215b423e | 250 | 'description' => ts('Action of the job api call'), |
e501603b TO |
251 | 'maxlength' => 255, |
252 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 253 | 'table_name' => 'civicrm_job', |
254 | 'entity' => 'Job', | |
255 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 256 | 'localizable' => 0, |
c3fc2621 CW |
257 | ], |
258 | 'parameters' => [ | |
e501603b TO |
259 | 'name' => 'parameters', |
260 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 261 | 'title' => ts('API Parameters'), |
215b423e | 262 | 'description' => ts('List of parameters to the command.'), |
e501603b TO |
263 | 'rows' => 4, |
264 | 'cols' => 60, | |
522a26c9 | 265 | 'table_name' => 'civicrm_job', |
266 | 'entity' => 'Job', | |
267 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 268 | 'localizable' => 0, |
c3fc2621 | 269 | 'html' => [ |
e501603b | 270 | 'type' => 'TextArea', |
c3fc2621 CW |
271 | ], |
272 | ], | |
273 | 'is_active' => [ | |
e501603b TO |
274 | 'name' => 'is_active', |
275 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 276 | 'title' => ts('Job Is Active?'), |
215b423e | 277 | 'description' => ts('Is this job active?'), |
522a26c9 | 278 | 'table_name' => 'civicrm_job', |
279 | 'entity' => 'Job', | |
280 | 'bao' => 'CRM_Core_BAO_Job', | |
6a7e5e5d | 281 | 'localizable' => 0, |
c3fc2621 CW |
282 | ], |
283 | ]; | |
346aaaba | 284 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 285 | } |
346aaaba | 286 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 287 | } |
c3fc2621 | 288 | |
e501603b | 289 | /** |
bd8e0b14 | 290 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
291 | * |
292 | * @return array | |
bd8e0b14 | 293 | * Array(string $name => string $uniqueName). |
e501603b | 294 | */ |
c3fc2621 | 295 | public static function &fieldKeys() { |
bd8e0b14 TO |
296 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
297 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 298 | } |
bd8e0b14 | 299 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 300 | } |
c3fc2621 | 301 | |
e501603b TO |
302 | /** |
303 | * Returns the names of this table | |
304 | * | |
305 | * @return string | |
306 | */ | |
c3fc2621 | 307 | public static function getTableName() { |
e501603b TO |
308 | return self::$_tableName; |
309 | } | |
c3fc2621 | 310 | |
e501603b TO |
311 | /** |
312 | * Returns if this table needs to be logged | |
313 | * | |
c3fc2621 | 314 | * @return bool |
e501603b | 315 | */ |
c3fc2621 | 316 | public function getLog() { |
e501603b TO |
317 | return self::$_log; |
318 | } | |
c3fc2621 | 319 | |
e501603b TO |
320 | /** |
321 | * Returns the list of fields that can be imported | |
322 | * | |
323 | * @param bool $prefix | |
324 | * | |
325 | * @return array | |
326 | */ | |
c3fc2621 CW |
327 | public static function &import($prefix = FALSE) { |
328 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, []); | |
60808919 | 329 | return $r; |
e501603b | 330 | } |
c3fc2621 | 331 | |
e501603b TO |
332 | /** |
333 | * Returns the list of fields that can be exported | |
334 | * | |
335 | * @param bool $prefix | |
336 | * | |
337 | * @return array | |
338 | */ | |
c3fc2621 CW |
339 | public static function &export($prefix = FALSE) { |
340 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, []); | |
60808919 | 341 | return $r; |
e501603b | 342 | } |
c3fc2621 | 343 | |
e7a6b91a AS |
344 | /** |
345 | * Returns the list of indices | |
c3fc2621 CW |
346 | * |
347 | * @param bool $localize | |
348 | * | |
349 | * @return array | |
e7a6b91a AS |
350 | */ |
351 | public static function indices($localize = TRUE) { | |
c3fc2621 | 352 | $indices = []; |
e7a6b91a AS |
353 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
354 | } | |
c3fc2621 | 355 | |
e501603b | 356 | } |