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:58e6fcaa028d157bfa074a073111239d)
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.
131 public function __construct() {
132 $this->__table
= 'civicrm_user_job';
133 parent
::__construct();
137 * Returns localized title of this entity.
139 * @param bool $plural
140 * Whether to return the plural version of the title.
142 public static function getEntityTitle($plural = FALSE) {
143 return $plural ?
ts('User Jobs') : ts('User Job');
147 * Returns foreign keys and entity references.
150 * [CRM_Core_Reference_Interface]
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']);
159 return Civi
::$statics[__CLASS__
]['links'];
163 * Returns all the column names of this table
167 public static function &fields() {
168 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
169 Civi
::$statics[__CLASS__
]['fields'] = [
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('User Job ID'),
174 'description' => ts('Job ID'),
176 'where' => 'civicrm_user_job.id',
177 'table_name' => 'civicrm_user_job',
178 'entity' => 'UserJob',
179 'bao' => 'CRM_Core_BAO_UserJob',
189 'type' => CRM_Utils_Type
::T_STRING
,
190 'title' => ts('User job name'),
191 'description' => ts('Unique name for job.'),
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',
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',
211 'FKClassName' => 'CRM_Contact_DAO_Contact',
213 'label' => ts("Created By"),
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.'),
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',
230 'type' => 'Select Date',
231 'formatType' => 'activityDateTime',
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.'),
242 'where' => 'civicrm_user_job.start_date',
243 'table_name' => 'civicrm_user_job',
244 'entity' => 'UserJob',
245 'bao' => 'CRM_Core_BAO_UserJob',
248 'type' => 'Select Date',
249 'formatType' => 'activityDateTime',
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.'),
260 'where' => 'civicrm_user_job.end_date',
261 'table_name' => 'civicrm_user_job',
262 'entity' => 'UserJob',
263 'bao' => 'CRM_Core_BAO_UserJob',
266 'type' => 'Select Date',
267 'formatType' => 'activityDateTime',
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).'),
277 'where' => 'civicrm_user_job.expires_date',
278 'table_name' => 'civicrm_user_job',
279 'entity' => 'UserJob',
280 'bao' => 'CRM_Core_BAO_UserJob',
283 'type' => 'Select Date',
284 'formatType' => 'activityDateTime',
289 'name' => 'status_id',
290 'type' => CRM_Utils_Type
::T_INT
,
291 'title' => ts('User Job Status ID'),
293 'where' => 'civicrm_user_job.status_id',
294 'table_name' => 'civicrm_user_job',
295 'entity' => 'UserJob',
296 'bao' => 'CRM_Core_BAO_UserJob',
299 'label' => ts("Job Status"),
301 'pseudoconstant' => [
302 'callback' => 'CRM_Core_BAO_UserJob::getStatuses',
308 'type' => CRM_Utils_Type
::T_INT
,
309 'title' => ts('User Job Type ID'),
311 'where' => 'civicrm_user_job.type_id',
312 'table_name' => 'civicrm_user_job',
313 'entity' => 'UserJob',
314 'bao' => 'CRM_Core_BAO_UserJob',
317 'label' => ts("Job Type"),
319 'pseudoconstant' => [
320 'callback' => 'CRM_Core_BAO_UserJob::getTypes',
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',
334 'FKClassName' => 'CRM_Queue_DAO_Queue',
336 'label' => ts("Queue"),
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',
350 'serialize' => self
::SERIALIZE_JSON
,
354 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
356 return Civi
::$statics[__CLASS__
]['fields'];
360 * Return a mapping from field-name to the corresponding key (as used in fields()).
363 * Array(string $name => string $uniqueName).
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()));
369 return Civi
::$statics[__CLASS__
]['fieldKeys'];
373 * Returns the names of this table
377 public static function getTableName() {
378 return self
::$_tableName;
382 * Returns if this table needs to be logged
386 public function getLog() {
391 * Returns the list of fields that can be imported
393 * @param bool $prefix
397 public static function &import($prefix = FALSE) {
398 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'user_job', $prefix, []);
403 * Returns the list of fields that can be exported
405 * @param bool $prefix
409 public static function &export($prefix = FALSE) {
410 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'user_job', $prefix, []);
415 * Returns the list of indices
417 * @param bool $localize
421 public static function indices($localize = TRUE) {
428 'localizable' => FALSE,
430 'sig' => 'civicrm_user_job::1::name',
433 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;