5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/UserJob.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4976da6332cddd37dbae0071e2319611)
13 * Database access object for the UserJob entity.
15 class CRM_Core_DAO_UserJob
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '5.50';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_user_job';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
34 * Paths for accessing this entity in the UI.
38 protected static $_paths = [
39 'view' => 'civicrm/import/contact/summary?reset=1&user_job_id=[id]',
45 * @var int|string|null
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
52 * Unique name for job.
55 * (SQL type: varchar(64))
56 * Note that values will be retrieved from the database as a string.
61 * FK to contact table.
63 * @var int|string|null
64 * (SQL type: int unsigned)
65 * Note that values will be retrieved from the database as a string.
70 * Date and time this job was created.
73 * (SQL type: timestamp)
74 * Note that values will be retrieved from the database as a string.
79 * Date and time this import job started.
82 * (SQL type: timestamp)
83 * Note that values will be retrieved from the database as a string.
88 * Date and time this import job ended.
91 * (SQL type: timestamp)
92 * Note that values will be retrieved from the database as a string.
97 * Date and time to clean up after this import job (temp table deletion date).
100 * (SQL type: timestamp)
101 * Note that values will be retrieved from the database as a string.
103 public $expires_date;
107 * (SQL type: int unsigned)
108 * Note that values will be retrieved from the database as a string.
113 * Name of the job type, which will allow finding the correct class
116 * (SQL type: varchar(64))
117 * Note that values will be retrieved from the database as a string.
124 * @var int|string|null
125 * (SQL type: int unsigned)
126 * Note that values will be retrieved from the database as a string.
131 * Data pertaining to job configuration
135 * Note that values will be retrieved from the database as a string.
140 * Is this a template configuration (for use by other/future jobs)?
143 * (SQL type: tinyint)
144 * Note that values will be retrieved from the database as a string.
151 public function __construct() {
152 $this->__table
= 'civicrm_user_job';
153 parent
::__construct();
157 * Returns localized title of this entity.
159 * @param bool $plural
160 * Whether to return the plural version of the title.
162 public static function getEntityTitle($plural = FALSE) {
163 return $plural ?
ts('User Jobs') : ts('User Job');
167 * Returns foreign keys and entity references.
170 * [CRM_Core_Reference_Interface]
172 public static function getReferenceColumns() {
173 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
174 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
175 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
176 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'queue_id', 'civicrm_queue', 'id');
177 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
179 return Civi
::$statics[__CLASS__
]['links'];
183 * Returns all the column names of this table
187 public static function &fields() {
188 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
189 Civi
::$statics[__CLASS__
]['fields'] = [
192 'type' => CRM_Utils_Type
::T_INT
,
193 'title' => ts('User Job ID'),
194 'description' => ts('Job ID'),
196 'where' => 'civicrm_user_job.id',
197 'table_name' => 'civicrm_user_job',
198 'entity' => 'UserJob',
199 'bao' => 'CRM_Core_BAO_UserJob',
209 'type' => CRM_Utils_Type
::T_STRING
,
210 'title' => ts('User job name'),
211 'description' => ts('Unique name for job.'),
213 'size' => CRM_Utils_Type
::BIG
,
214 'where' => 'civicrm_user_job.name',
215 'table_name' => 'civicrm_user_job',
216 'entity' => 'UserJob',
217 'bao' => 'CRM_Core_BAO_UserJob',
222 'name' => 'created_id',
223 'type' => CRM_Utils_Type
::T_INT
,
224 'title' => ts('Created By Contact ID'),
225 'description' => ts('FK to contact table.'),
226 'where' => 'civicrm_user_job.created_id',
227 'table_name' => 'civicrm_user_job',
228 'entity' => 'UserJob',
229 'bao' => 'CRM_Core_BAO_UserJob',
231 'FKClassName' => 'CRM_Contact_DAO_Contact',
233 'label' => ts("Created By"),
238 'name' => 'created_date',
239 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
240 'title' => ts('Import Job Created Date'),
241 'description' => ts('Date and time this job was created.'),
243 'where' => 'civicrm_user_job.created_date',
244 'default' => 'CURRENT_TIMESTAMP',
245 'table_name' => 'civicrm_user_job',
246 'entity' => 'UserJob',
247 'bao' => 'CRM_Core_BAO_UserJob',
250 'type' => 'Select Date',
251 'formatType' => 'activityDateTime',
257 'name' => 'start_date',
258 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
259 'title' => ts('Import Job Started Date'),
260 'description' => ts('Date and time this import job started.'),
262 'where' => 'civicrm_user_job.start_date',
263 'table_name' => 'civicrm_user_job',
264 'entity' => 'UserJob',
265 'bao' => 'CRM_Core_BAO_UserJob',
268 'type' => 'Select Date',
269 'formatType' => 'activityDateTime',
275 'name' => 'end_date',
276 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
277 'title' => ts('Job Ended Date'),
278 'description' => ts('Date and time this import job ended.'),
280 'where' => 'civicrm_user_job.end_date',
281 'table_name' => 'civicrm_user_job',
282 'entity' => 'UserJob',
283 'bao' => 'CRM_Core_BAO_UserJob',
286 'type' => 'Select Date',
287 'formatType' => 'activityDateTime',
292 'name' => 'expires_date',
293 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
294 'title' => ts('Import Job Expires Date'),
295 'description' => ts('Date and time to clean up after this import job (temp table deletion date).'),
297 'where' => 'civicrm_user_job.expires_date',
298 'table_name' => 'civicrm_user_job',
299 'entity' => 'UserJob',
300 'bao' => 'CRM_Core_BAO_UserJob',
303 'type' => 'Select Date',
304 'formatType' => 'activityDateTime',
309 'name' => 'status_id',
310 'type' => CRM_Utils_Type
::T_INT
,
311 'title' => ts('User Job Status ID'),
313 'where' => 'civicrm_user_job.status_id',
314 'table_name' => 'civicrm_user_job',
315 'entity' => 'UserJob',
316 'bao' => 'CRM_Core_BAO_UserJob',
319 'label' => ts("Job Status"),
321 'pseudoconstant' => [
322 'callback' => 'CRM_Core_BAO_UserJob::getStatuses',
327 'name' => 'job_type',
328 'type' => CRM_Utils_Type
::T_STRING
,
329 'title' => ts('User Job Type'),
330 'description' => ts('Name of the job type, which will allow finding the correct class'),
333 'size' => CRM_Utils_Type
::BIG
,
334 'where' => 'civicrm_user_job.job_type',
335 'table_name' => 'civicrm_user_job',
336 'entity' => 'UserJob',
337 'bao' => 'CRM_Core_BAO_UserJob',
340 'label' => ts("Job Type"),
342 'pseudoconstant' => [
343 'callback' => 'CRM_Core_BAO_UserJob::getTypes',
348 'name' => 'queue_id',
349 'type' => CRM_Utils_Type
::T_INT
,
350 'title' => ts('Queue ID'),
351 'description' => ts('FK to Queue'),
352 'where' => 'civicrm_user_job.queue_id',
353 'table_name' => 'civicrm_user_job',
354 'entity' => 'UserJob',
355 'bao' => 'CRM_Core_BAO_UserJob',
357 'FKClassName' => 'CRM_Queue_DAO_Queue',
359 'label' => ts("Queue"),
364 'name' => 'metadata',
365 'type' => CRM_Utils_Type
::T_TEXT
,
366 'title' => ts('Job metadata'),
367 'description' => ts('Data pertaining to job configuration'),
368 'where' => 'civicrm_user_job.metadata',
369 'table_name' => 'civicrm_user_job',
370 'entity' => 'UserJob',
371 'bao' => 'CRM_Core_BAO_UserJob',
373 'serialize' => self
::SERIALIZE_JSON
,
377 'name' => 'is_template',
378 'type' => CRM_Utils_Type
::T_BOOLEAN
,
379 'title' => ts('Is Template'),
380 'description' => ts('Is this a template configuration (for use by other/future jobs)?'),
382 'where' => 'civicrm_user_job.is_template',
384 'table_name' => 'civicrm_user_job',
385 'entity' => 'UserJob',
386 'bao' => 'CRM_Core_BAO_UserJob',
389 'type' => 'CheckBox',
390 'label' => ts("Is Template"),
395 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
397 return Civi
::$statics[__CLASS__
]['fields'];
401 * Return a mapping from field-name to the corresponding key (as used in fields()).
404 * Array(string $name => string $uniqueName).
406 public static function &fieldKeys() {
407 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
408 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
410 return Civi
::$statics[__CLASS__
]['fieldKeys'];
414 * Returns the names of this table
418 public static function getTableName() {
419 return self
::$_tableName;
423 * Returns if this table needs to be logged
427 public function getLog() {
432 * Returns the list of fields that can be imported
434 * @param bool $prefix
438 public static function &import($prefix = FALSE) {
439 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'user_job', $prefix, []);
444 * Returns the list of fields that can be exported
446 * @param bool $prefix
450 public static function &export($prefix = FALSE) {
451 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'user_job', $prefix, []);
456 * Returns the list of indices
458 * @param bool $localize
462 public static function indices($localize = TRUE) {
469 'localizable' => FALSE,
471 'sig' => 'civicrm_user_job::1::name',
474 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;