Merge pull request #22335 from braders/participant-static-method
[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
2562d09a 9 * (GenCodeChecksum:e5798e1ce73654af23730d7188a0c963)
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 33 /**
2cbbebe8 34 * Job ID
e501603b 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'),
2cbbebe8 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,
2cbbebe8
A
162 'html' => [
163 'type' => 'Number',
164 ],
1fe423d6 165 'readonly' => TRUE,
a9d0587b 166 'add' => '4.1',
c3fc2621
CW
167 ],
168 'domain_id' => [
e501603b
TO
169 'name' => 'domain_id',
170 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 171 'title' => ts('Domain ID'),
215b423e 172 'description' => ts('Which Domain is this scheduled job for'),
c3fc2621 173 'required' => TRUE,
a36434b9 174 'where' => 'civicrm_job.domain_id',
522a26c9 175 'table_name' => 'civicrm_job',
176 'entity' => 'Job',
177 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 178 'localizable' => 0,
e501603b 179 'FKClassName' => 'CRM_Core_DAO_Domain',
2cbbebe8
A
180 'html' => [
181 'label' => ts("Domain"),
182 ],
c3fc2621 183 'pseudoconstant' => [
e501603b
TO
184 'table' => 'civicrm_domain',
185 'keyColumn' => 'id',
186 'labelColumn' => 'name',
e6ca0a57 187 ],
a9d0587b 188 'add' => '4.1',
c3fc2621
CW
189 ],
190 'run_frequency' => [
e501603b
TO
191 'name' => 'run_frequency',
192 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 193 'title' => ts('Job Frequency'),
215b423e 194 'description' => ts('Scheduled job run frequency.'),
e501603b
TO
195 'maxlength' => 8,
196 'size' => CRM_Utils_Type::EIGHT,
a36434b9 197 'where' => 'civicrm_job.run_frequency',
e501603b 198 'default' => 'Daily',
522a26c9 199 'table_name' => 'civicrm_job',
200 'entity' => 'Job',
201 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 202 'localizable' => 0,
c3fc2621 203 'html' => [
e501603b 204 'type' => 'Select',
c3fc2621
CW
205 ],
206 'pseudoconstant' => [
e501603b 207 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
e6ca0a57 208 ],
a9d0587b 209 'add' => '4.1',
c3fc2621
CW
210 ],
211 'last_run' => [
e501603b 212 'name' => 'last_run',
6c2b97b7 213 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 214 'title' => ts('Last Run'),
215b423e 215 'description' => ts('When was this cron entry last run'),
c3fc2621 216 'required' => FALSE,
a36434b9 217 'where' => 'civicrm_job.last_run',
5fb0de1f 218 'default' => NULL,
522a26c9 219 'table_name' => 'civicrm_job',
220 'entity' => 'Job',
221 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 222 'localizable' => 0,
c23563e3
SL
223 'html' => [
224 'label' => ts("Last Run"),
225 ],
a9d0587b 226 'add' => '4.1',
c3fc2621
CW
227 ],
228 'scheduled_run_date' => [
e501603b
TO
229 'name' => 'scheduled_run_date',
230 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 231 'title' => ts('Scheduled Run Date'),
215b423e 232 'description' => ts('When is this cron entry scheduled to run'),
c3fc2621 233 'required' => FALSE,
a36434b9 234 'where' => 'civicrm_job.scheduled_run_date',
5fb0de1f 235 'default' => NULL,
522a26c9 236 'table_name' => 'civicrm_job',
237 'entity' => 'Job',
238 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 239 'localizable' => 0,
c23563e3
SL
240 'html' => [
241 'label' => ts("Scheduled Run Date"),
242 ],
a9d0587b 243 'add' => '4.7',
c3fc2621
CW
244 ],
245 'name' => [
e501603b
TO
246 'name' => 'name',
247 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 248 'title' => ts('Job Name'),
215b423e 249 'description' => ts('Title of the job'),
e501603b
TO
250 'maxlength' => 255,
251 'size' => CRM_Utils_Type::HUGE,
a36434b9 252 'where' => 'civicrm_job.name',
522a26c9 253 'table_name' => 'civicrm_job',
254 'entity' => 'Job',
255 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 256 'localizable' => 0,
a9d0587b 257 'add' => '4.1',
c3fc2621
CW
258 ],
259 'description' => [
e501603b
TO
260 'name' => 'description',
261 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 262 'title' => ts('Job Description'),
215b423e 263 'description' => ts('Description of the job'),
e501603b
TO
264 'maxlength' => 255,
265 'size' => CRM_Utils_Type::HUGE,
a36434b9 266 'where' => 'civicrm_job.description',
522a26c9 267 'table_name' => 'civicrm_job',
268 'entity' => 'Job',
269 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 270 'localizable' => 0,
a9d0587b 271 'add' => '4.1',
c3fc2621
CW
272 ],
273 'api_entity' => [
e501603b
TO
274 'name' => 'api_entity',
275 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 276 'title' => ts('API Entity'),
215b423e 277 'description' => ts('Entity of the job api call'),
e501603b
TO
278 'maxlength' => 255,
279 'size' => CRM_Utils_Type::HUGE,
a36434b9 280 'where' => 'civicrm_job.api_entity',
522a26c9 281 'table_name' => 'civicrm_job',
282 'entity' => 'Job',
283 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 284 'localizable' => 0,
a9d0587b 285 'add' => '4.1',
c3fc2621
CW
286 ],
287 'api_action' => [
e501603b
TO
288 'name' => 'api_action',
289 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 290 'title' => ts('API Action'),
215b423e 291 'description' => ts('Action of the job api call'),
e501603b
TO
292 'maxlength' => 255,
293 'size' => CRM_Utils_Type::HUGE,
a36434b9 294 'where' => 'civicrm_job.api_action',
522a26c9 295 'table_name' => 'civicrm_job',
296 'entity' => 'Job',
297 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 298 'localizable' => 0,
a9d0587b 299 'add' => '4.1',
c3fc2621
CW
300 ],
301 'parameters' => [
e501603b
TO
302 'name' => 'parameters',
303 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 304 'title' => ts('API Parameters'),
215b423e 305 'description' => ts('List of parameters to the command.'),
e501603b
TO
306 'rows' => 4,
307 'cols' => 60,
a36434b9 308 'where' => 'civicrm_job.parameters',
522a26c9 309 'table_name' => 'civicrm_job',
310 'entity' => 'Job',
311 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 312 'localizable' => 0,
c3fc2621 313 'html' => [
e501603b 314 'type' => 'TextArea',
c3fc2621 315 ],
a9d0587b 316 'add' => '4.1',
c3fc2621
CW
317 ],
318 'is_active' => [
e501603b
TO
319 'name' => 'is_active',
320 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 321 'title' => ts('Job Is Active?'),
215b423e 322 'description' => ts('Is this job active?'),
a36434b9 323 'where' => 'civicrm_job.is_active',
522a26c9 324 'table_name' => 'civicrm_job',
325 'entity' => 'Job',
326 'bao' => 'CRM_Core_BAO_Job',
6a7e5e5d 327 'localizable' => 0,
a9d0587b 328 'add' => '4.1',
c3fc2621
CW
329 ],
330 ];
346aaaba 331 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 332 }
346aaaba 333 return Civi::$statics[__CLASS__]['fields'];
e501603b 334 }
c3fc2621 335
e501603b 336 /**
bd8e0b14 337 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
338 *
339 * @return array
bd8e0b14 340 * Array(string $name => string $uniqueName).
e501603b 341 */
c3fc2621 342 public static function &fieldKeys() {
bd8e0b14
TO
343 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
344 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 345 }
bd8e0b14 346 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 347 }
c3fc2621 348
e501603b
TO
349 /**
350 * Returns the names of this table
351 *
352 * @return string
353 */
c3fc2621 354 public static function getTableName() {
e501603b
TO
355 return self::$_tableName;
356 }
c3fc2621 357
e501603b
TO
358 /**
359 * Returns if this table needs to be logged
360 *
c3fc2621 361 * @return bool
e501603b 362 */
c3fc2621 363 public function getLog() {
e501603b
TO
364 return self::$_log;
365 }
c3fc2621 366
e501603b
TO
367 /**
368 * Returns the list of fields that can be imported
369 *
370 * @param bool $prefix
371 *
372 * @return array
373 */
c3fc2621
CW
374 public static function &import($prefix = FALSE) {
375 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, []);
60808919 376 return $r;
e501603b 377 }
c3fc2621 378
e501603b
TO
379 /**
380 * Returns the list of fields that can be exported
381 *
382 * @param bool $prefix
383 *
384 * @return array
385 */
c3fc2621
CW
386 public static function &export($prefix = FALSE) {
387 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, []);
60808919 388 return $r;
e501603b 389 }
c3fc2621 390
e7a6b91a
AS
391 /**
392 * Returns the list of indices
c3fc2621
CW
393 *
394 * @param bool $localize
395 *
396 * @return array
e7a6b91a
AS
397 */
398 public static function indices($localize = TRUE) {
c3fc2621 399 $indices = [];
e7a6b91a
AS
400 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
401 }
c3fc2621 402
e501603b 403}