Merge pull request #23190 from eileenmcnaughton/pradeep
[civicrm-core.git] / CRM / Core / DAO / UserJob.php
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
9 * (GenCodeChecksum:58e6fcaa028d157bfa074a073111239d)
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
33 /**
34 * Job ID
35 *
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * Unique name for job.
44 *
45 * @var string|null
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $name;
50
51 /**
52 * FK to contact table.
53 *
54 * @var int|string|null
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $created_id;
59
60 /**
61 * Date and time this job was created.
62 *
63 * @var string
64 * (SQL type: timestamp)
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $created_date;
68
69 /**
70 * Date and time this import job started.
71 *
72 * @var string
73 * (SQL type: timestamp)
74 * Note that values will be retrieved from the database as a string.
75 */
76 public $start_date;
77
78 /**
79 * Date and time this import job ended.
80 *
81 * @var string
82 * (SQL type: timestamp)
83 * Note that values will be retrieved from the database as a string.
84 */
85 public $end_date;
86
87 /**
88 * Date and time to clean up after this import job (temp table deletion date).
89 *
90 * @var string
91 * (SQL type: timestamp)
92 * Note that values will be retrieved from the database as a string.
93 */
94 public $expires_date;
95
96 /**
97 * @var int|string
98 * (SQL type: int unsigned)
99 * Note that values will be retrieved from the database as a string.
100 */
101 public $status_id;
102
103 /**
104 * @var int|string
105 * (SQL type: int unsigned)
106 * Note that values will be retrieved from the database as a string.
107 */
108 public $type_id;
109
110 /**
111 * FK to Queue
112 *
113 * @var int|string|null
114 * (SQL type: int unsigned)
115 * Note that values will be retrieved from the database as a string.
116 */
117 public $queue_id;
118
119 /**
120 * Data pertaining to job configuration
121 *
122 * @var string|null
123 * (SQL type: text)
124 * Note that values will be retrieved from the database as a string.
125 */
126 public $metadata;
127
128 /**
129 * Class constructor.
130 */
131 public function __construct() {
132 $this->__table = 'civicrm_user_job';
133 parent::__construct();
134 }
135
136 /**
137 * Returns localized title of this entity.
138 *
139 * @param bool $plural
140 * Whether to return the plural version of the title.
141 */
142 public static function getEntityTitle($plural = FALSE) {
143 return $plural ? ts('User Jobs') : ts('User Job');
144 }
145
146 /**
147 * Returns foreign keys and entity references.
148 *
149 * @return array
150 * [CRM_Core_Reference_Interface]
151 */
152 public static function getReferenceColumns() {
153 if (!isset(Civi::$statics[__CLASS__]['links'])) {
154 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
155 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id');
156 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'queue_id', 'civicrm_queue', 'id');
157 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
158 }
159 return Civi::$statics[__CLASS__]['links'];
160 }
161
162 /**
163 * Returns all the column names of this table
164 *
165 * @return array
166 */
167 public static function &fields() {
168 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
169 Civi::$statics[__CLASS__]['fields'] = [
170 'id' => [
171 'name' => 'id',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('User Job ID'),
174 'description' => ts('Job ID'),
175 'required' => TRUE,
176 'where' => 'civicrm_user_job.id',
177 'table_name' => 'civicrm_user_job',
178 'entity' => 'UserJob',
179 'bao' => 'CRM_Core_BAO_UserJob',
180 'localizable' => 0,
181 'html' => [
182 'type' => 'Number',
183 ],
184 'readonly' => TRUE,
185 'add' => '5.50',
186 ],
187 'name' => [
188 'name' => 'name',
189 'type' => CRM_Utils_Type::T_STRING,
190 'title' => ts('User job name'),
191 'description' => ts('Unique name for job.'),
192 'maxlength' => 64,
193 'size' => CRM_Utils_Type::BIG,
194 'where' => 'civicrm_user_job.name',
195 'table_name' => 'civicrm_user_job',
196 'entity' => 'UserJob',
197 'bao' => 'CRM_Core_BAO_UserJob',
198 'localizable' => 0,
199 'add' => '5.50',
200 ],
201 'created_id' => [
202 'name' => 'created_id',
203 'type' => CRM_Utils_Type::T_INT,
204 'title' => ts('Created By Contact ID'),
205 'description' => ts('FK to contact table.'),
206 'where' => 'civicrm_user_job.created_id',
207 'table_name' => 'civicrm_user_job',
208 'entity' => 'UserJob',
209 'bao' => 'CRM_Core_BAO_UserJob',
210 'localizable' => 0,
211 'FKClassName' => 'CRM_Contact_DAO_Contact',
212 'html' => [
213 'label' => ts("Created By"),
214 ],
215 'add' => '5.50',
216 ],
217 'created_date' => [
218 'name' => 'created_date',
219 'type' => CRM_Utils_Type::T_TIMESTAMP,
220 'title' => ts('Import Job Created Date'),
221 'description' => ts('Date and time this job was created.'),
222 'required' => TRUE,
223 'where' => 'civicrm_user_job.created_date',
224 'default' => 'CURRENT_TIMESTAMP',
225 'table_name' => 'civicrm_user_job',
226 'entity' => 'UserJob',
227 'bao' => 'CRM_Core_BAO_UserJob',
228 'localizable' => 0,
229 'html' => [
230 'type' => 'Select Date',
231 'formatType' => 'activityDateTime',
232 ],
233 'readonly' => TRUE,
234 'add' => '5.50',
235 ],
236 'start_date' => [
237 'name' => 'start_date',
238 'type' => CRM_Utils_Type::T_TIMESTAMP,
239 'title' => ts('Import Job Started Date'),
240 'description' => ts('Date and time this import job started.'),
241 'required' => FALSE,
242 'where' => 'civicrm_user_job.start_date',
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 'end_date' => [
255 'name' => 'end_date',
256 'type' => CRM_Utils_Type::T_TIMESTAMP,
257 'title' => ts('Job Ended Date'),
258 'description' => ts('Date and time this import job ended.'),
259 'required' => FALSE,
260 'where' => 'civicrm_user_job.end_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 'add' => '5.50',
270 ],
271 'expires_date' => [
272 'name' => 'expires_date',
273 'type' => CRM_Utils_Type::T_TIMESTAMP,
274 'title' => ts('Import Job Expires Date'),
275 'description' => ts('Date and time to clean up after this import job (temp table deletion date).'),
276 'required' => FALSE,
277 'where' => 'civicrm_user_job.expires_date',
278 'table_name' => 'civicrm_user_job',
279 'entity' => 'UserJob',
280 'bao' => 'CRM_Core_BAO_UserJob',
281 'localizable' => 0,
282 'html' => [
283 'type' => 'Select Date',
284 'formatType' => 'activityDateTime',
285 ],
286 'add' => '5.50',
287 ],
288 'status_id' => [
289 'name' => 'status_id',
290 'type' => CRM_Utils_Type::T_INT,
291 'title' => ts('User Job Status ID'),
292 'required' => TRUE,
293 'where' => 'civicrm_user_job.status_id',
294 'table_name' => 'civicrm_user_job',
295 'entity' => 'UserJob',
296 'bao' => 'CRM_Core_BAO_UserJob',
297 'localizable' => 0,
298 'html' => [
299 'label' => ts("Job Status"),
300 ],
301 'pseudoconstant' => [
302 'callback' => 'CRM_Core_BAO_UserJob::getStatuses',
303 ],
304 'add' => '5.50',
305 ],
306 'type_id' => [
307 'name' => 'type_id',
308 'type' => CRM_Utils_Type::T_INT,
309 'title' => ts('User Job Type ID'),
310 'required' => TRUE,
311 'where' => 'civicrm_user_job.type_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 Type"),
318 ],
319 'pseudoconstant' => [
320 'callback' => 'CRM_Core_BAO_UserJob::getTypes',
321 ],
322 'add' => '5.50',
323 ],
324 'queue_id' => [
325 'name' => 'queue_id',
326 'type' => CRM_Utils_Type::T_INT,
327 'title' => ts('Queue ID'),
328 'description' => ts('FK to Queue'),
329 'where' => 'civicrm_user_job.queue_id',
330 'table_name' => 'civicrm_user_job',
331 'entity' => 'UserJob',
332 'bao' => 'CRM_Core_BAO_UserJob',
333 'localizable' => 0,
334 'FKClassName' => 'CRM_Queue_DAO_Queue',
335 'html' => [
336 'label' => ts("Queue"),
337 ],
338 'add' => NULL,
339 ],
340 'metadata' => [
341 'name' => 'metadata',
342 'type' => CRM_Utils_Type::T_TEXT,
343 'title' => ts('Job metadata'),
344 'description' => ts('Data pertaining to job configuration'),
345 'where' => 'civicrm_user_job.metadata',
346 'table_name' => 'civicrm_user_job',
347 'entity' => 'UserJob',
348 'bao' => 'CRM_Core_BAO_UserJob',
349 'localizable' => 0,
350 'serialize' => self::SERIALIZE_JSON,
351 'add' => '5.50',
352 ],
353 ];
354 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
355 }
356 return Civi::$statics[__CLASS__]['fields'];
357 }
358
359 /**
360 * Return a mapping from field-name to the corresponding key (as used in fields()).
361 *
362 * @return array
363 * Array(string $name => string $uniqueName).
364 */
365 public static function &fieldKeys() {
366 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
367 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
368 }
369 return Civi::$statics[__CLASS__]['fieldKeys'];
370 }
371
372 /**
373 * Returns the names of this table
374 *
375 * @return string
376 */
377 public static function getTableName() {
378 return self::$_tableName;
379 }
380
381 /**
382 * Returns if this table needs to be logged
383 *
384 * @return bool
385 */
386 public function getLog() {
387 return self::$_log;
388 }
389
390 /**
391 * Returns the list of fields that can be imported
392 *
393 * @param bool $prefix
394 *
395 * @return array
396 */
397 public static function &import($prefix = FALSE) {
398 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'user_job', $prefix, []);
399 return $r;
400 }
401
402 /**
403 * Returns the list of fields that can be exported
404 *
405 * @param bool $prefix
406 *
407 * @return array
408 */
409 public static function &export($prefix = FALSE) {
410 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'user_job', $prefix, []);
411 return $r;
412 }
413
414 /**
415 * Returns the list of indices
416 *
417 * @param bool $localize
418 *
419 * @return array
420 */
421 public static function indices($localize = TRUE) {
422 $indices = [
423 'UI_name' => [
424 'name' => 'UI_name',
425 'field' => [
426 0 => 'name',
427 ],
428 'localizable' => FALSE,
429 'unique' => TRUE,
430 'sig' => 'civicrm_user_job::1::name',
431 ],
432 ];
433 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
434 }
435
436 }