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:dbe7ab7b35b9ebe7f7248cc6385e19b6)
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.
114 * (SQL type: int unsigned)
115 * Note that values will be retrieved from the database as a string.
122 * @var int|string|null
123 * (SQL type: int unsigned)
124 * Note that values will be retrieved from the database as a string.
129 * Data pertaining to job configuration
133 * Note that values will be retrieved from the database as a string.
138 * Is this a template configuration (for use by other/future jobs)?
141 * (SQL type: tinyint)
142 * Note that values will be retrieved from the database as a string.
149 public function __construct() {
150 $this->__table
= 'civicrm_user_job';
151 parent
::__construct();
155 * Returns localized title of this entity.
157 * @param bool $plural
158 * Whether to return the plural version of the title.
160 public static function getEntityTitle($plural = FALSE) {
161 return $plural ?
ts('User Jobs') : ts('User Job');
165 * Returns foreign keys and entity references.
168 * [CRM_Core_Reference_Interface]
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']);
177 return Civi
::$statics[__CLASS__
]['links'];
181 * Returns all the column names of this table
185 public static function &fields() {
186 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
187 Civi
::$statics[__CLASS__
]['fields'] = [
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('User Job ID'),
192 'description' => ts('Job ID'),
194 'where' => 'civicrm_user_job.id',
195 'table_name' => 'civicrm_user_job',
196 'entity' => 'UserJob',
197 'bao' => 'CRM_Core_BAO_UserJob',
207 'type' => CRM_Utils_Type
::T_STRING
,
208 'title' => ts('User job name'),
209 'description' => ts('Unique name for job.'),
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',
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',
229 'FKClassName' => 'CRM_Contact_DAO_Contact',
231 'label' => ts("Created By"),
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.'),
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',
248 'type' => 'Select Date',
249 'formatType' => 'activityDateTime',
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.'),
260 'where' => 'civicrm_user_job.start_date',
261 'table_name' => 'civicrm_user_job',
262 'entity' => 'UserJob',
263 'bao' => 'CRM_Core_BAO_UserJob',
266 'type' => 'Select Date',
267 'formatType' => 'activityDateTime',
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.'),
278 'where' => 'civicrm_user_job.end_date',
279 'table_name' => 'civicrm_user_job',
280 'entity' => 'UserJob',
281 'bao' => 'CRM_Core_BAO_UserJob',
284 'type' => 'Select Date',
285 'formatType' => 'activityDateTime',
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).'),
295 'where' => 'civicrm_user_job.expires_date',
296 'table_name' => 'civicrm_user_job',
297 'entity' => 'UserJob',
298 'bao' => 'CRM_Core_BAO_UserJob',
301 'type' => 'Select Date',
302 'formatType' => 'activityDateTime',
307 'name' => 'status_id',
308 'type' => CRM_Utils_Type
::T_INT
,
309 'title' => ts('User Job Status ID'),
311 'where' => 'civicrm_user_job.status_id',
312 'table_name' => 'civicrm_user_job',
313 'entity' => 'UserJob',
314 'bao' => 'CRM_Core_BAO_UserJob',
317 'label' => ts("Job Status"),
319 'pseudoconstant' => [
320 'callback' => 'CRM_Core_BAO_UserJob::getStatuses',
326 'type' => CRM_Utils_Type
::T_INT
,
327 'title' => ts('User Job Type ID'),
329 'where' => 'civicrm_user_job.type_id',
330 'table_name' => 'civicrm_user_job',
331 'entity' => 'UserJob',
332 'bao' => 'CRM_Core_BAO_UserJob',
335 'label' => ts("Job Type"),
337 'pseudoconstant' => [
338 'callback' => 'CRM_Core_BAO_UserJob::getTypes',
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',
352 'FKClassName' => 'CRM_Queue_DAO_Queue',
354 'label' => ts("Queue"),
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',
368 'serialize' => self
::SERIALIZE_JSON
,
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)?'),
377 'where' => 'civicrm_user_job.is_template',
379 'table_name' => 'civicrm_user_job',
380 'entity' => 'UserJob',
381 'bao' => 'CRM_Core_BAO_UserJob',
384 'type' => 'CheckBox',
385 'label' => ts("Is Template"),
390 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
392 return Civi
::$statics[__CLASS__
]['fields'];
396 * Return a mapping from field-name to the corresponding key (as used in fields()).
399 * Array(string $name => string $uniqueName).
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()));
405 return Civi
::$statics[__CLASS__
]['fieldKeys'];
409 * Returns the names of this table
413 public static function getTableName() {
414 return self
::$_tableName;
418 * Returns if this table needs to be logged
422 public function getLog() {
427 * Returns the list of fields that can be imported
429 * @param bool $prefix
433 public static function &import($prefix = FALSE) {
434 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'user_job', $prefix, []);
439 * Returns the list of fields that can be exported
441 * @param bool $prefix
445 public static function &export($prefix = FALSE) {
446 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'user_job', $prefix, []);
451 * Returns the list of indices
453 * @param bool $localize
457 public static function indices($localize = TRUE) {
464 'localizable' => FALSE,
466 'sig' => 'civicrm_user_job::1::name',
469 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;