5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Job.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b6077b55d593903b9ab9f673c40dd1b1)
13 * Database access object for the Job entity.
15 class CRM_Core_DAO_Job
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_job';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
41 * Which Domain is this scheduled job for
48 * Scheduled job run frequency.
52 public $run_frequency;
55 * When was this cron entry last run
62 * When is this cron entry scheduled to run
66 public $scheduled_run_date;
76 * Description of the job
83 * Entity of the job api call
90 * Action of the job api call
97 * List of parameters to the command.
104 * Is this job active?
113 public function __construct() {
114 $this->__table
= 'civicrm_job';
115 parent
::__construct();
119 * Returns localized title of this entity.
121 * @param bool $plural
122 * Whether to return the plural version of the title.
124 public static function getEntityTitle($plural = FALSE) {
125 return $plural ?
ts('Jobs') : ts('Job');
129 * Returns foreign keys and entity references.
132 * [CRM_Core_Reference_Interface]
134 public static function getReferenceColumns() {
135 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
136 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
137 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
138 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
140 return Civi
::$statics[__CLASS__
]['links'];
144 * Returns all the column names of this table
148 public static function &fields() {
149 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
150 Civi
::$statics[__CLASS__
]['fields'] = [
153 'type' => CRM_Utils_Type
::T_INT
,
154 'title' => ts('Job ID'),
155 'description' => ts('Job ID'),
157 'where' => 'civicrm_job.id',
158 'table_name' => 'civicrm_job',
160 'bao' => 'CRM_Core_BAO_Job',
168 'name' => 'domain_id',
169 'type' => CRM_Utils_Type
::T_INT
,
170 'title' => ts('Domain ID'),
171 'description' => ts('Which Domain is this scheduled job for'),
173 'where' => 'civicrm_job.domain_id',
174 'table_name' => 'civicrm_job',
176 'bao' => 'CRM_Core_BAO_Job',
178 'FKClassName' => 'CRM_Core_DAO_Domain',
180 'label' => ts("Domain"),
182 'pseudoconstant' => [
183 'table' => 'civicrm_domain',
185 'labelColumn' => 'name',
190 'name' => 'run_frequency',
191 'type' => CRM_Utils_Type
::T_STRING
,
192 'title' => ts('Job Frequency'),
193 'description' => ts('Scheduled job run frequency.'),
195 'size' => CRM_Utils_Type
::EIGHT
,
196 'where' => 'civicrm_job.run_frequency',
197 'default' => 'Daily',
198 'table_name' => 'civicrm_job',
200 'bao' => 'CRM_Core_BAO_Job',
205 'pseudoconstant' => [
206 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
211 'name' => 'last_run',
212 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
213 'title' => ts('Last Run'),
214 'description' => ts('When was this cron entry last run'),
216 'where' => 'civicrm_job.last_run',
218 'table_name' => 'civicrm_job',
220 'bao' => 'CRM_Core_BAO_Job',
223 'label' => ts("Last Run"),
227 'scheduled_run_date' => [
228 'name' => 'scheduled_run_date',
229 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
230 'title' => ts('Scheduled Run Date'),
231 'description' => ts('When is this cron entry scheduled to run'),
233 'where' => 'civicrm_job.scheduled_run_date',
235 'table_name' => 'civicrm_job',
237 'bao' => 'CRM_Core_BAO_Job',
240 'label' => ts("Scheduled Run Date"),
246 'type' => CRM_Utils_Type
::T_STRING
,
247 'title' => ts('Job Name'),
248 'description' => ts('Title of the job'),
250 'size' => CRM_Utils_Type
::HUGE
,
251 'where' => 'civicrm_job.name',
252 'table_name' => 'civicrm_job',
254 'bao' => 'CRM_Core_BAO_Job',
259 'name' => 'description',
260 'type' => CRM_Utils_Type
::T_STRING
,
261 'title' => ts('Job Description'),
262 'description' => ts('Description of the job'),
264 'size' => CRM_Utils_Type
::HUGE
,
265 'where' => 'civicrm_job.description',
266 'table_name' => 'civicrm_job',
268 'bao' => 'CRM_Core_BAO_Job',
273 'name' => 'api_entity',
274 'type' => CRM_Utils_Type
::T_STRING
,
275 'title' => ts('API Entity'),
276 'description' => ts('Entity of the job api call'),
278 'size' => CRM_Utils_Type
::HUGE
,
279 'where' => 'civicrm_job.api_entity',
280 'table_name' => 'civicrm_job',
282 'bao' => 'CRM_Core_BAO_Job',
287 'name' => 'api_action',
288 'type' => CRM_Utils_Type
::T_STRING
,
289 'title' => ts('API Action'),
290 'description' => ts('Action of the job api call'),
292 'size' => CRM_Utils_Type
::HUGE
,
293 'where' => 'civicrm_job.api_action',
294 'table_name' => 'civicrm_job',
296 'bao' => 'CRM_Core_BAO_Job',
301 'name' => 'parameters',
302 'type' => CRM_Utils_Type
::T_TEXT
,
303 'title' => ts('API Parameters'),
304 'description' => ts('List of parameters to the command.'),
307 'where' => 'civicrm_job.parameters',
308 'table_name' => 'civicrm_job',
310 'bao' => 'CRM_Core_BAO_Job',
313 'type' => 'TextArea',
318 'name' => 'is_active',
319 'type' => CRM_Utils_Type
::T_BOOLEAN
,
320 'title' => ts('Job Is Active?'),
321 'description' => ts('Is this job active?'),
322 'where' => 'civicrm_job.is_active',
323 'table_name' => 'civicrm_job',
325 'bao' => 'CRM_Core_BAO_Job',
330 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
332 return Civi
::$statics[__CLASS__
]['fields'];
336 * Return a mapping from field-name to the corresponding key (as used in fields()).
339 * Array(string $name => string $uniqueName).
341 public static function &fieldKeys() {
342 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
343 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
345 return Civi
::$statics[__CLASS__
]['fieldKeys'];
349 * Returns the names of this table
353 public static function getTableName() {
354 return self
::$_tableName;
358 * Returns if this table needs to be logged
362 public function getLog() {
367 * Returns the list of fields that can be imported
369 * @param bool $prefix
373 public static function &import($prefix = FALSE) {
374 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'job', $prefix, []);
379 * Returns the list of fields that can be exported
381 * @param bool $prefix
385 public static function &export($prefix = FALSE) {
386 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'job', $prefix, []);
391 * Returns the list of indices
393 * @param bool $localize
397 public static function indices($localize = TRUE) {
399 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;