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