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