Commit | Line | Data |
---|---|---|
a082d2df EM |
1 | <?php |
2 | ||
3 | /** | |
4 | * @package CRM | |
5 | * @copyright CiviCRM LLC https://civicrm.org/licensing | |
6 | * | |
7 | * Generated from xml/schema/CRM/Core/UserJob.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
b91685f5 | 9 | * (GenCodeChecksum:dbe7ab7b35b9ebe7f7248cc6385e19b6) |
a082d2df EM |
10 | */ |
11 | ||
12 | /** | |
13 | * Database access object for the UserJob entity. | |
14 | */ | |
15 | class CRM_Core_DAO_UserJob extends CRM_Core_DAO { | |
16 | const EXT = 'civicrm'; | |
17 | const TABLE_ADDED = '5.50'; | |
18 | ||
19 | /** | |
20 | * Static instance to hold the table name. | |
21 | * | |
22 | * @var string | |
23 | */ | |
24 | public static $_tableName = 'civicrm_user_job'; | |
25 | ||
26 | /** | |
27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. | |
28 | * | |
29 | * @var bool | |
30 | */ | |
31 | public static $_log = FALSE; | |
32 | ||
b91685f5 EM |
33 | /** |
34 | * Paths for accessing this entity in the UI. | |
35 | * | |
36 | * @var string[] | |
37 | */ | |
38 | protected static $_paths = [ | |
39 | 'view' => 'civicrm/import/contact/summary?reset=1&user_job_id=[id]', | |
40 | ]; | |
41 | ||
a082d2df EM |
42 | /** |
43 | * Job ID | |
44 | * | |
45 | * @var int|string|null | |
46 | * (SQL type: int unsigned) | |
47 | * Note that values will be retrieved from the database as a string. | |
48 | */ | |
49 | public $id; | |
50 | ||
51 | /** | |
52 | * Unique name for job. | |
53 | * | |
54 | * @var string|null | |
55 | * (SQL type: varchar(64)) | |
56 | * Note that values will be retrieved from the database as a string. | |
57 | */ | |
58 | public $name; | |
59 | ||
60 | /** | |
61 | * FK to contact table. | |
62 | * | |
63 | * @var int|string|null | |
64 | * (SQL type: int unsigned) | |
65 | * Note that values will be retrieved from the database as a string. | |
66 | */ | |
67 | public $created_id; | |
68 | ||
69 | /** | |
70 | * Date and time this job was created. | |
71 | * | |
72 | * @var string | |
73 | * (SQL type: timestamp) | |
74 | * Note that values will be retrieved from the database as a string. | |
75 | */ | |
76 | public $created_date; | |
77 | ||
78 | /** | |
79 | * Date and time this import job started. | |
80 | * | |
81 | * @var string | |
82 | * (SQL type: timestamp) | |
83 | * Note that values will be retrieved from the database as a string. | |
84 | */ | |
85 | public $start_date; | |
86 | ||
87 | /** | |
88 | * Date and time this import job ended. | |
89 | * | |
90 | * @var string | |
91 | * (SQL type: timestamp) | |
92 | * Note that values will be retrieved from the database as a string. | |
93 | */ | |
94 | public $end_date; | |
95 | ||
96 | /** | |
97 | * Date and time to clean up after this import job (temp table deletion date). | |
98 | * | |
99 | * @var string | |
100 | * (SQL type: timestamp) | |
101 | * Note that values will be retrieved from the database as a string. | |
102 | */ | |
103 | public $expires_date; | |
104 | ||
105 | /** | |
106 | * @var int|string | |
107 | * (SQL type: int unsigned) | |
108 | * Note that values will be retrieved from the database as a string. | |
109 | */ | |
110 | public $status_id; | |
111 | ||
112 | /** | |
113 | * @var int|string | |
114 | * (SQL type: int unsigned) | |
115 | * Note that values will be retrieved from the database as a string. | |
116 | */ | |
117 | public $type_id; | |
118 | ||
119 | /** | |
120 | * FK to Queue | |
121 | * | |
122 | * @var int|string|null | |
123 | * (SQL type: int unsigned) | |
124 | * Note that values will be retrieved from the database as a string. | |
125 | */ | |
126 | public $queue_id; | |
127 | ||
128 | /** | |
129 | * Data pertaining to job configuration | |
130 | * | |
131 | * @var string|null | |
132 | * (SQL type: text) | |
133 | * Note that values will be retrieved from the database as a string. | |
134 | */ | |
135 | public $metadata; | |
136 | ||
77b7441a TO |
137 | /** |
138 | * Is this a template configuration (for use by other/future jobs)? | |
139 | * | |
140 | * @var bool|string | |
141 | * (SQL type: tinyint) | |
142 | * Note that values will be retrieved from the database as a string. | |
143 | */ | |
144 | public $is_template; | |
145 | ||
a082d2df EM |
146 | /** |
147 | * Class constructor. | |
148 | */ | |
149 | public function __construct() { | |
150 | $this->__table = 'civicrm_user_job'; | |
151 | parent::__construct(); | |
152 | } | |
153 | ||
154 | /** | |
155 | * Returns localized title of this entity. | |
156 | * | |
157 | * @param bool $plural | |
158 | * Whether to return the plural version of the title. | |
159 | */ | |
160 | public static function getEntityTitle($plural = FALSE) { | |
161 | return $plural ? ts('User Jobs') : ts('User Job'); | |
162 | } | |
163 | ||
164 | /** | |
165 | * Returns foreign keys and entity references. | |
166 | * | |
167 | * @return array | |
168 | * [CRM_Core_Reference_Interface] | |
169 | */ | |
170 | public static function getReferenceColumns() { | |
171 | if (!isset(Civi::$statics[__CLASS__]['links'])) { | |
172 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); | |
173 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); | |
174 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'queue_id', 'civicrm_queue', 'id'); | |
175 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
176 | } | |
177 | return Civi::$statics[__CLASS__]['links']; | |
178 | } | |
179 | ||
180 | /** | |
181 | * Returns all the column names of this table | |
182 | * | |
183 | * @return array | |
184 | */ | |
185 | public static function &fields() { | |
186 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { | |
187 | Civi::$statics[__CLASS__]['fields'] = [ | |
188 | 'id' => [ | |
189 | 'name' => 'id', | |
190 | 'type' => CRM_Utils_Type::T_INT, | |
191 | 'title' => ts('User Job ID'), | |
192 | 'description' => ts('Job ID'), | |
193 | 'required' => TRUE, | |
194 | 'where' => 'civicrm_user_job.id', | |
195 | 'table_name' => 'civicrm_user_job', | |
196 | 'entity' => 'UserJob', | |
197 | 'bao' => 'CRM_Core_BAO_UserJob', | |
198 | 'localizable' => 0, | |
199 | 'html' => [ | |
200 | 'type' => 'Number', | |
201 | ], | |
202 | 'readonly' => TRUE, | |
203 | 'add' => '5.50', | |
204 | ], | |
205 | 'name' => [ | |
206 | 'name' => 'name', | |
207 | 'type' => CRM_Utils_Type::T_STRING, | |
208 | 'title' => ts('User job name'), | |
209 | 'description' => ts('Unique name for job.'), | |
210 | 'maxlength' => 64, | |
211 | 'size' => CRM_Utils_Type::BIG, | |
212 | 'where' => 'civicrm_user_job.name', | |
213 | 'table_name' => 'civicrm_user_job', | |
214 | 'entity' => 'UserJob', | |
215 | 'bao' => 'CRM_Core_BAO_UserJob', | |
216 | 'localizable' => 0, | |
217 | 'add' => '5.50', | |
218 | ], | |
219 | 'created_id' => [ | |
220 | 'name' => 'created_id', | |
221 | 'type' => CRM_Utils_Type::T_INT, | |
222 | 'title' => ts('Created By Contact ID'), | |
223 | 'description' => ts('FK to contact table.'), | |
224 | 'where' => 'civicrm_user_job.created_id', | |
225 | 'table_name' => 'civicrm_user_job', | |
226 | 'entity' => 'UserJob', | |
227 | 'bao' => 'CRM_Core_BAO_UserJob', | |
228 | 'localizable' => 0, | |
229 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
230 | 'html' => [ | |
231 | 'label' => ts("Created By"), | |
232 | ], | |
233 | 'add' => '5.50', | |
234 | ], | |
235 | 'created_date' => [ | |
236 | 'name' => 'created_date', | |
237 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
238 | 'title' => ts('Import Job Created Date'), | |
239 | 'description' => ts('Date and time this job was created.'), | |
240 | 'required' => TRUE, | |
241 | 'where' => 'civicrm_user_job.created_date', | |
242 | 'default' => 'CURRENT_TIMESTAMP', | |
243 | 'table_name' => 'civicrm_user_job', | |
244 | 'entity' => 'UserJob', | |
245 | 'bao' => 'CRM_Core_BAO_UserJob', | |
246 | 'localizable' => 0, | |
247 | 'html' => [ | |
248 | 'type' => 'Select Date', | |
249 | 'formatType' => 'activityDateTime', | |
250 | ], | |
251 | 'readonly' => TRUE, | |
252 | 'add' => '5.50', | |
253 | ], | |
254 | 'start_date' => [ | |
255 | 'name' => 'start_date', | |
256 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
257 | 'title' => ts('Import Job Started Date'), | |
258 | 'description' => ts('Date and time this import job started.'), | |
259 | 'required' => FALSE, | |
260 | 'where' => 'civicrm_user_job.start_date', | |
261 | 'table_name' => 'civicrm_user_job', | |
262 | 'entity' => 'UserJob', | |
263 | 'bao' => 'CRM_Core_BAO_UserJob', | |
264 | 'localizable' => 0, | |
265 | 'html' => [ | |
266 | 'type' => 'Select Date', | |
267 | 'formatType' => 'activityDateTime', | |
268 | ], | |
269 | 'readonly' => TRUE, | |
270 | 'add' => '5.50', | |
271 | ], | |
272 | 'end_date' => [ | |
273 | 'name' => 'end_date', | |
274 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
275 | 'title' => ts('Job Ended Date'), | |
276 | 'description' => ts('Date and time this import job ended.'), | |
277 | 'required' => FALSE, | |
278 | 'where' => 'civicrm_user_job.end_date', | |
279 | 'table_name' => 'civicrm_user_job', | |
280 | 'entity' => 'UserJob', | |
281 | 'bao' => 'CRM_Core_BAO_UserJob', | |
282 | 'localizable' => 0, | |
283 | 'html' => [ | |
284 | 'type' => 'Select Date', | |
285 | 'formatType' => 'activityDateTime', | |
286 | ], | |
287 | 'add' => '5.50', | |
288 | ], | |
289 | 'expires_date' => [ | |
290 | 'name' => 'expires_date', | |
291 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
292 | 'title' => ts('Import Job Expires Date'), | |
293 | 'description' => ts('Date and time to clean up after this import job (temp table deletion date).'), | |
294 | 'required' => FALSE, | |
295 | 'where' => 'civicrm_user_job.expires_date', | |
296 | 'table_name' => 'civicrm_user_job', | |
297 | 'entity' => 'UserJob', | |
298 | 'bao' => 'CRM_Core_BAO_UserJob', | |
299 | 'localizable' => 0, | |
300 | 'html' => [ | |
301 | 'type' => 'Select Date', | |
302 | 'formatType' => 'activityDateTime', | |
303 | ], | |
304 | 'add' => '5.50', | |
305 | ], | |
306 | 'status_id' => [ | |
307 | 'name' => 'status_id', | |
308 | 'type' => CRM_Utils_Type::T_INT, | |
309 | 'title' => ts('User Job Status ID'), | |
310 | 'required' => TRUE, | |
311 | 'where' => 'civicrm_user_job.status_id', | |
312 | 'table_name' => 'civicrm_user_job', | |
313 | 'entity' => 'UserJob', | |
314 | 'bao' => 'CRM_Core_BAO_UserJob', | |
315 | 'localizable' => 0, | |
316 | 'html' => [ | |
317 | 'label' => ts("Job Status"), | |
318 | ], | |
319 | 'pseudoconstant' => [ | |
320 | 'callback' => 'CRM_Core_BAO_UserJob::getStatuses', | |
321 | ], | |
322 | 'add' => '5.50', | |
323 | ], | |
324 | 'type_id' => [ | |
325 | 'name' => 'type_id', | |
326 | 'type' => CRM_Utils_Type::T_INT, | |
327 | 'title' => ts('User Job Type ID'), | |
328 | 'required' => TRUE, | |
329 | 'where' => 'civicrm_user_job.type_id', | |
330 | 'table_name' => 'civicrm_user_job', | |
331 | 'entity' => 'UserJob', | |
332 | 'bao' => 'CRM_Core_BAO_UserJob', | |
333 | 'localizable' => 0, | |
334 | 'html' => [ | |
335 | 'label' => ts("Job Type"), | |
336 | ], | |
337 | 'pseudoconstant' => [ | |
338 | 'callback' => 'CRM_Core_BAO_UserJob::getTypes', | |
339 | ], | |
340 | 'add' => '5.50', | |
341 | ], | |
342 | 'queue_id' => [ | |
343 | 'name' => 'queue_id', | |
344 | 'type' => CRM_Utils_Type::T_INT, | |
345 | 'title' => ts('Queue ID'), | |
346 | 'description' => ts('FK to Queue'), | |
347 | 'where' => 'civicrm_user_job.queue_id', | |
348 | 'table_name' => 'civicrm_user_job', | |
349 | 'entity' => 'UserJob', | |
350 | 'bao' => 'CRM_Core_BAO_UserJob', | |
351 | 'localizable' => 0, | |
352 | 'FKClassName' => 'CRM_Queue_DAO_Queue', | |
353 | 'html' => [ | |
354 | 'label' => ts("Queue"), | |
355 | ], | |
356 | 'add' => NULL, | |
357 | ], | |
358 | 'metadata' => [ | |
359 | 'name' => 'metadata', | |
360 | 'type' => CRM_Utils_Type::T_TEXT, | |
361 | 'title' => ts('Job metadata'), | |
362 | 'description' => ts('Data pertaining to job configuration'), | |
363 | 'where' => 'civicrm_user_job.metadata', | |
364 | 'table_name' => 'civicrm_user_job', | |
365 | 'entity' => 'UserJob', | |
366 | 'bao' => 'CRM_Core_BAO_UserJob', | |
367 | 'localizable' => 0, | |
368 | 'serialize' => self::SERIALIZE_JSON, | |
369 | 'add' => '5.50', | |
370 | ], | |
77b7441a TO |
371 | 'is_template' => [ |
372 | 'name' => 'is_template', | |
373 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
374 | 'title' => ts('Is Template'), | |
375 | 'description' => ts('Is this a template configuration (for use by other/future jobs)?'), | |
376 | 'required' => TRUE, | |
377 | 'where' => 'civicrm_user_job.is_template', | |
378 | 'default' => '0', | |
379 | 'table_name' => 'civicrm_user_job', | |
380 | 'entity' => 'UserJob', | |
381 | 'bao' => 'CRM_Core_BAO_UserJob', | |
382 | 'localizable' => 0, | |
383 | 'html' => [ | |
384 | 'type' => 'CheckBox', | |
385 | 'label' => ts("Is Template"), | |
386 | ], | |
387 | 'add' => '5.51', | |
388 | ], | |
a082d2df EM |
389 | ]; |
390 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); | |
391 | } | |
392 | return Civi::$statics[__CLASS__]['fields']; | |
393 | } | |
394 | ||
395 | /** | |
396 | * Return a mapping from field-name to the corresponding key (as used in fields()). | |
397 | * | |
398 | * @return array | |
399 | * Array(string $name => string $uniqueName). | |
400 | */ | |
401 | public static function &fieldKeys() { | |
402 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { | |
403 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
404 | } | |
405 | return Civi::$statics[__CLASS__]['fieldKeys']; | |
406 | } | |
407 | ||
408 | /** | |
409 | * Returns the names of this table | |
410 | * | |
411 | * @return string | |
412 | */ | |
413 | public static function getTableName() { | |
414 | return self::$_tableName; | |
415 | } | |
416 | ||
417 | /** | |
418 | * Returns if this table needs to be logged | |
419 | * | |
420 | * @return bool | |
421 | */ | |
422 | public function getLog() { | |
423 | return self::$_log; | |
424 | } | |
425 | ||
426 | /** | |
427 | * Returns the list of fields that can be imported | |
428 | * | |
429 | * @param bool $prefix | |
430 | * | |
431 | * @return array | |
432 | */ | |
433 | public static function &import($prefix = FALSE) { | |
434 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'user_job', $prefix, []); | |
435 | return $r; | |
436 | } | |
437 | ||
438 | /** | |
439 | * Returns the list of fields that can be exported | |
440 | * | |
441 | * @param bool $prefix | |
442 | * | |
443 | * @return array | |
444 | */ | |
445 | public static function &export($prefix = FALSE) { | |
446 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'user_job', $prefix, []); | |
447 | return $r; | |
448 | } | |
449 | ||
450 | /** | |
451 | * Returns the list of indices | |
452 | * | |
453 | * @param bool $localize | |
454 | * | |
455 | * @return array | |
456 | */ | |
457 | public static function indices($localize = TRUE) { | |
458 | $indices = [ | |
459 | 'UI_name' => [ | |
460 | 'name' => 'UI_name', | |
461 | 'field' => [ | |
462 | 0 => 'name', | |
463 | ], | |
464 | 'localizable' => FALSE, | |
465 | 'unique' => TRUE, | |
466 | 'sig' => 'civicrm_user_job::1::name', | |
467 | ], | |
468 | ]; | |
469 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
470 | } | |
471 | ||
472 | } |