API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Core / DAO / Job.php
CommitLineData
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
a9d0587b 9 * (GenCodeChecksum:8f64b00207fd2c2f98c378c01e29b911)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Job entity.
f41f0342 14 */
e501603b 15class 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
449c4e6b
CW
116 /**
117 * Returns localized title of this entity.
118 */
119 public static function getEntityTitle() {
120 return ts('Jobs');
121 }
122
e501603b 123 /**
f41f0342 124 * Returns foreign keys and entity references.
e501603b
TO
125 *
126 * @return array
127 * [CRM_Core_Reference_Interface]
128 */
c3fc2621 129 public static function getReferenceColumns() {
346aaaba 130 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 131 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 132 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
346aaaba 133 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 134 }
346aaaba 135 return Civi::$statics[__CLASS__]['links'];
e501603b 136 }
c3fc2621 137
e501603b
TO
138 /**
139 * Returns all the column names of this table
140 *
141 * @return array
142 */
c3fc2621 143 public static function &fields() {
346aaaba 144 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
145 Civi::$statics[__CLASS__]['fields'] = [
146 'id' => [
e501603b
TO
147 'name' => 'id',
148 'type' => CRM_Utils_Type::T_INT,
c3fc2621 149 'title' => ts('Job ID'),
215b423e 150 'description' => ts('Job Id'),
c3fc2621 151 'required' => TRUE,
a36434b9 152 'where' => 'civicrm_job.id',
522a26c9 153 'table_name' => 'civicrm_job',
154 'entity' => 'Job',
155 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 156 'localizable' => 0,
a9d0587b 157 'add' => '4.1',
c3fc2621
CW
158 ],
159 'domain_id' => [
e501603b
TO
160 'name' => 'domain_id',
161 'type' => CRM_Utils_Type::T_INT,
c3fc2621 162 'title' => ts('Job Domain'),
215b423e 163 'description' => ts('Which Domain is this scheduled job for'),
c3fc2621 164 'required' => TRUE,
a36434b9 165 'where' => 'civicrm_job.domain_id',
522a26c9 166 'table_name' => 'civicrm_job',
167 'entity' => 'Job',
168 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 169 'localizable' => 0,
e501603b 170 'FKClassName' => 'CRM_Core_DAO_Domain',
c3fc2621 171 'pseudoconstant' => [
e501603b
TO
172 'table' => 'civicrm_domain',
173 'keyColumn' => 'id',
174 'labelColumn' => 'name',
e6ca0a57 175 ],
a9d0587b 176 'add' => '4.1',
c3fc2621
CW
177 ],
178 'run_frequency' => [
e501603b
TO
179 'name' => 'run_frequency',
180 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 181 'title' => ts('Job Frequency'),
215b423e 182 'description' => ts('Scheduled job run frequency.'),
e501603b
TO
183 'maxlength' => 8,
184 'size' => CRM_Utils_Type::EIGHT,
a36434b9 185 'where' => 'civicrm_job.run_frequency',
e501603b 186 'default' => 'Daily',
522a26c9 187 'table_name' => 'civicrm_job',
188 'entity' => 'Job',
189 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 190 'localizable' => 0,
c3fc2621 191 'html' => [
e501603b 192 'type' => 'Select',
c3fc2621
CW
193 ],
194 'pseudoconstant' => [
e501603b 195 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
e6ca0a57 196 ],
a9d0587b 197 'add' => '4.1',
c3fc2621
CW
198 ],
199 'last_run' => [
e501603b 200 'name' => 'last_run',
6c2b97b7 201 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 202 'title' => ts('Last Run'),
215b423e 203 'description' => ts('When was this cron entry last run'),
c3fc2621 204 'required' => FALSE,
a36434b9 205 'where' => 'civicrm_job.last_run',
e501603b 206 'default' => 'NULL',
522a26c9 207 'table_name' => 'civicrm_job',
208 'entity' => 'Job',
209 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 210 'localizable' => 0,
a9d0587b 211 'add' => '4.1',
c3fc2621
CW
212 ],
213 'scheduled_run_date' => [
e501603b
TO
214 'name' => 'scheduled_run_date',
215 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 216 'title' => ts('Scheduled Run Date'),
215b423e 217 'description' => ts('When is this cron entry scheduled to run'),
c3fc2621 218 'required' => FALSE,
a36434b9 219 'where' => 'civicrm_job.scheduled_run_date',
e501603b 220 'default' => 'NULL',
522a26c9 221 'table_name' => 'civicrm_job',
222 'entity' => 'Job',
223 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 224 'localizable' => 0,
a9d0587b 225 'add' => '4.7',
c3fc2621
CW
226 ],
227 'name' => [
e501603b
TO
228 'name' => 'name',
229 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 230 'title' => ts('Job Name'),
215b423e 231 'description' => ts('Title of the job'),
e501603b
TO
232 'maxlength' => 255,
233 'size' => CRM_Utils_Type::HUGE,
a36434b9 234 'where' => 'civicrm_job.name',
522a26c9 235 'table_name' => 'civicrm_job',
236 'entity' => 'Job',
237 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 238 'localizable' => 0,
a9d0587b 239 'add' => '4.1',
c3fc2621
CW
240 ],
241 'description' => [
e501603b
TO
242 'name' => 'description',
243 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 244 'title' => ts('Job Description'),
215b423e 245 'description' => ts('Description of the job'),
e501603b
TO
246 'maxlength' => 255,
247 'size' => CRM_Utils_Type::HUGE,
a36434b9 248 'where' => 'civicrm_job.description',
522a26c9 249 'table_name' => 'civicrm_job',
250 'entity' => 'Job',
251 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 252 'localizable' => 0,
a9d0587b 253 'add' => '4.1',
c3fc2621
CW
254 ],
255 'api_entity' => [
e501603b
TO
256 'name' => 'api_entity',
257 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 258 'title' => ts('API Entity'),
215b423e 259 'description' => ts('Entity of the job api call'),
e501603b
TO
260 'maxlength' => 255,
261 'size' => CRM_Utils_Type::HUGE,
a36434b9 262 'where' => 'civicrm_job.api_entity',
522a26c9 263 'table_name' => 'civicrm_job',
264 'entity' => 'Job',
265 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 266 'localizable' => 0,
a9d0587b 267 'add' => '4.1',
c3fc2621
CW
268 ],
269 'api_action' => [
e501603b
TO
270 'name' => 'api_action',
271 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 272 'title' => ts('API Action'),
215b423e 273 'description' => ts('Action of the job api call'),
e501603b
TO
274 'maxlength' => 255,
275 'size' => CRM_Utils_Type::HUGE,
a36434b9 276 'where' => 'civicrm_job.api_action',
522a26c9 277 'table_name' => 'civicrm_job',
278 'entity' => 'Job',
279 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 280 'localizable' => 0,
a9d0587b 281 'add' => '4.1',
c3fc2621
CW
282 ],
283 'parameters' => [
e501603b
TO
284 'name' => 'parameters',
285 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 286 'title' => ts('API Parameters'),
215b423e 287 'description' => ts('List of parameters to the command.'),
e501603b
TO
288 'rows' => 4,
289 'cols' => 60,
a36434b9 290 'where' => 'civicrm_job.parameters',
522a26c9 291 'table_name' => 'civicrm_job',
292 'entity' => 'Job',
293 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 294 'localizable' => 0,
c3fc2621 295 'html' => [
e501603b 296 'type' => 'TextArea',
c3fc2621 297 ],
a9d0587b 298 'add' => '4.1',
c3fc2621
CW
299 ],
300 'is_active' => [
e501603b
TO
301 'name' => 'is_active',
302 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 303 'title' => ts('Job Is Active?'),
215b423e 304 'description' => ts('Is this job active?'),
a36434b9 305 'where' => 'civicrm_job.is_active',
522a26c9 306 'table_name' => 'civicrm_job',
307 'entity' => 'Job',
308 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 309 'localizable' => 0,
a9d0587b 310 'add' => '4.1',
c3fc2621
CW
311 ],
312 ];
346aaaba 313 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 314 }
346aaaba 315 return Civi::$statics[__CLASS__]['fields'];
e501603b 316 }
c3fc2621 317
e501603b 318 /**
bd8e0b14 319 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
320 *
321 * @return array
bd8e0b14 322 * Array(string $name => string $uniqueName).
e501603b 323 */
c3fc2621 324 public static function &fieldKeys() {
bd8e0b14
TO
325 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
326 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 327 }
bd8e0b14 328 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 329 }
c3fc2621 330
e501603b
TO
331 /**
332 * Returns the names of this table
333 *
334 * @return string
335 */
c3fc2621 336 public static function getTableName() {
e501603b
TO
337 return self::$_tableName;
338 }
c3fc2621 339
e501603b
TO
340 /**
341 * Returns if this table needs to be logged
342 *
c3fc2621 343 * @return bool
e501603b 344 */
c3fc2621 345 public function getLog() {
e501603b
TO
346 return self::$_log;
347 }
c3fc2621 348
e501603b
TO
349 /**
350 * Returns the list of fields that can be imported
351 *
352 * @param bool $prefix
353 *
354 * @return array
355 */
c3fc2621
CW
356 public static function &import($prefix = FALSE) {
357 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, []);
60808919 358 return $r;
e501603b 359 }
c3fc2621 360
e501603b
TO
361 /**
362 * Returns the list of fields that can be exported
363 *
364 * @param bool $prefix
365 *
366 * @return array
367 */
c3fc2621
CW
368 public static function &export($prefix = FALSE) {
369 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, []);
60808919 370 return $r;
e501603b 371 }
c3fc2621 372
e7a6b91a
AS
373 /**
374 * Returns the list of indices
c3fc2621
CW
375 *
376 * @param bool $localize
377 *
378 * @return array
e7a6b91a
AS
379 */
380 public static function indices($localize = TRUE) {
c3fc2621 381 $indices = [];
e7a6b91a
AS
382 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
383 }
c3fc2621 384
e501603b 385}