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:fc2efbbf7b26018fe3dff0cda44ffa28)
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;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Unique name for job.
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
52 * FK to contact table.
54 * @var int|string|null
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
61 * Date and time this job was created.
64 * (SQL type: timestamp)
65 * Note that values will be retrieved from the database as a string.
70 * Date and time this import job started.
73 * (SQL type: timestamp)
74 * Note that values will be retrieved from the database as a string.
79 * Date and time this import job ended.
82 * (SQL type: timestamp)
83 * Note that values will be retrieved from the database as a string.
88 * Date and time to clean up after this import job (temp table deletion date).
91 * (SQL type: timestamp)
92 * Note that values will be retrieved from the database as a string.
98 * (SQL type: int unsigned)
99 * Note that values will be retrieved from the database as a string.
105 * (SQL type: int unsigned)
106 * Note that values will be retrieved from the database as a string.
113 * @var int|string|null
114 * (SQL type: int unsigned)
115 * Note that values will be retrieved from the database as a string.
120 * Data pertaining to job configuration
124 * Note that values will be retrieved from the database as a string.
129 * Is this a template configuration (for use by other/future jobs)?
132 * (SQL type: tinyint)
133 * Note that values will be retrieved from the database as a string.
140 public function __construct() {
141 $this->__table
= 'civicrm_user_job';
142 parent
::__construct();
146 * Returns localized title of this entity.
148 * @param bool $plural
149 * Whether to return the plural version of the title.
151 public static function getEntityTitle($plural = FALSE) {
152 return $plural ?
ts('User Jobs') : ts('User Job');
156 * Returns foreign keys and entity references.
159 * [CRM_Core_Reference_Interface]
161 public static function getReferenceColumns() {
162 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
163 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
164 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'created_id', 'civicrm_contact', 'id');
165 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'queue_id', 'civicrm_queue', 'id');
166 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
168 return Civi
::$statics[__CLASS__
]['links'];
172 * Returns all the column names of this table
176 public static function &fields() {
177 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
178 Civi
::$statics[__CLASS__
]['fields'] = [
181 'type' => CRM_Utils_Type
::T_INT
,
182 'title' => ts('User Job ID'),
183 'description' => ts('Job ID'),
185 'where' => 'civicrm_user_job.id',
186 'table_name' => 'civicrm_user_job',
187 'entity' => 'UserJob',
188 'bao' => 'CRM_Core_BAO_UserJob',
198 'type' => CRM_Utils_Type
::T_STRING
,
199 'title' => ts('User job name'),
200 'description' => ts('Unique name for job.'),
202 'size' => CRM_Utils_Type
::BIG
,
203 'where' => 'civicrm_user_job.name',
204 'table_name' => 'civicrm_user_job',
205 'entity' => 'UserJob',
206 'bao' => 'CRM_Core_BAO_UserJob',
211 'name' => 'created_id',
212 'type' => CRM_Utils_Type
::T_INT
,
213 'title' => ts('Created By Contact ID'),
214 'description' => ts('FK to contact table.'),
215 'where' => 'civicrm_user_job.created_id',
216 'table_name' => 'civicrm_user_job',
217 'entity' => 'UserJob',
218 'bao' => 'CRM_Core_BAO_UserJob',
220 'FKClassName' => 'CRM_Contact_DAO_Contact',
222 'label' => ts("Created By"),
227 'name' => 'created_date',
228 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
229 'title' => ts('Import Job Created Date'),
230 'description' => ts('Date and time this job was created.'),
232 'where' => 'civicrm_user_job.created_date',
233 'default' => 'CURRENT_TIMESTAMP',
234 'table_name' => 'civicrm_user_job',
235 'entity' => 'UserJob',
236 'bao' => 'CRM_Core_BAO_UserJob',
239 'type' => 'Select Date',
240 'formatType' => 'activityDateTime',
246 'name' => 'start_date',
247 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
248 'title' => ts('Import Job Started Date'),
249 'description' => ts('Date and time this import job started.'),
251 'where' => 'civicrm_user_job.start_date',
252 'table_name' => 'civicrm_user_job',
253 'entity' => 'UserJob',
254 'bao' => 'CRM_Core_BAO_UserJob',
257 'type' => 'Select Date',
258 'formatType' => 'activityDateTime',
264 'name' => 'end_date',
265 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
266 'title' => ts('Job Ended Date'),
267 'description' => ts('Date and time this import job ended.'),
269 'where' => 'civicrm_user_job.end_date',
270 'table_name' => 'civicrm_user_job',
271 'entity' => 'UserJob',
272 'bao' => 'CRM_Core_BAO_UserJob',
275 'type' => 'Select Date',
276 'formatType' => 'activityDateTime',
281 'name' => 'expires_date',
282 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
283 'title' => ts('Import Job Expires Date'),
284 'description' => ts('Date and time to clean up after this import job (temp table deletion date).'),
286 'where' => 'civicrm_user_job.expires_date',
287 'table_name' => 'civicrm_user_job',
288 'entity' => 'UserJob',
289 'bao' => 'CRM_Core_BAO_UserJob',
292 'type' => 'Select Date',
293 'formatType' => 'activityDateTime',
298 'name' => 'status_id',
299 'type' => CRM_Utils_Type
::T_INT
,
300 'title' => ts('User Job Status ID'),
302 'where' => 'civicrm_user_job.status_id',
303 'table_name' => 'civicrm_user_job',
304 'entity' => 'UserJob',
305 'bao' => 'CRM_Core_BAO_UserJob',
308 'label' => ts("Job Status"),
310 'pseudoconstant' => [
311 'callback' => 'CRM_Core_BAO_UserJob::getStatuses',
317 'type' => CRM_Utils_Type
::T_INT
,
318 'title' => ts('User Job Type ID'),
320 'where' => 'civicrm_user_job.type_id',
321 'table_name' => 'civicrm_user_job',
322 'entity' => 'UserJob',
323 'bao' => 'CRM_Core_BAO_UserJob',
326 'label' => ts("Job Type"),
328 'pseudoconstant' => [
329 'callback' => 'CRM_Core_BAO_UserJob::getTypes',
334 'name' => 'queue_id',
335 'type' => CRM_Utils_Type
::T_INT
,
336 'title' => ts('Queue ID'),
337 'description' => ts('FK to Queue'),
338 'where' => 'civicrm_user_job.queue_id',
339 'table_name' => 'civicrm_user_job',
340 'entity' => 'UserJob',
341 'bao' => 'CRM_Core_BAO_UserJob',
343 'FKClassName' => 'CRM_Queue_DAO_Queue',
345 'label' => ts("Queue"),
350 'name' => 'metadata',
351 'type' => CRM_Utils_Type
::T_TEXT
,
352 'title' => ts('Job metadata'),
353 'description' => ts('Data pertaining to job configuration'),
354 'where' => 'civicrm_user_job.metadata',
355 'table_name' => 'civicrm_user_job',
356 'entity' => 'UserJob',
357 'bao' => 'CRM_Core_BAO_UserJob',
359 'serialize' => self
::SERIALIZE_JSON
,
363 'name' => 'is_template',
364 'type' => CRM_Utils_Type
::T_BOOLEAN
,
365 'title' => ts('Is Template'),
366 'description' => ts('Is this a template configuration (for use by other/future jobs)?'),
368 'where' => 'civicrm_user_job.is_template',
370 'table_name' => 'civicrm_user_job',
371 'entity' => 'UserJob',
372 'bao' => 'CRM_Core_BAO_UserJob',
375 'type' => 'CheckBox',
376 'label' => ts("Is Template"),
381 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
383 return Civi
::$statics[__CLASS__
]['fields'];
387 * Return a mapping from field-name to the corresponding key (as used in fields()).
390 * Array(string $name => string $uniqueName).
392 public static function &fieldKeys() {
393 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
394 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
396 return Civi
::$statics[__CLASS__
]['fieldKeys'];
400 * Returns the names of this table
404 public static function getTableName() {
405 return self
::$_tableName;
409 * Returns if this table needs to be logged
413 public function getLog() {
418 * Returns the list of fields that can be imported
420 * @param bool $prefix
424 public static function &import($prefix = FALSE) {
425 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'user_job', $prefix, []);
430 * Returns the list of fields that can be exported
432 * @param bool $prefix
436 public static function &export($prefix = FALSE) {
437 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'user_job', $prefix, []);
442 * Returns the list of indices
444 * @param bool $localize
448 public static function indices($localize = TRUE) {
455 'localizable' => FALSE,
457 'sig' => 'civicrm_user_job::1::name',
460 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;