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