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