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:e5798e1ce73654af23730d7188a0c963)
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',
169 'name' => 'domain_id',
170 'type' => CRM_Utils_Type
::T_INT
,
171 'title' => ts('Domain ID'),
172 'description' => ts('Which Domain is this scheduled job for'),
174 'where' => 'civicrm_job.domain_id',
175 'table_name' => 'civicrm_job',
177 'bao' => 'CRM_Core_BAO_Job',
179 'FKClassName' => 'CRM_Core_DAO_Domain',
181 'label' => ts("Domain"),
183 'pseudoconstant' => [
184 'table' => 'civicrm_domain',
186 'labelColumn' => 'name',
191 'name' => 'run_frequency',
192 'type' => CRM_Utils_Type
::T_STRING
,
193 'title' => ts('Job Frequency'),
194 'description' => ts('Scheduled job run frequency.'),
196 'size' => CRM_Utils_Type
::EIGHT
,
197 'where' => 'civicrm_job.run_frequency',
198 'default' => 'Daily',
199 'table_name' => 'civicrm_job',
201 'bao' => 'CRM_Core_BAO_Job',
206 'pseudoconstant' => [
207 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
212 'name' => 'last_run',
213 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
214 'title' => ts('Last Run'),
215 'description' => ts('When was this cron entry last run'),
217 'where' => 'civicrm_job.last_run',
219 'table_name' => 'civicrm_job',
221 'bao' => 'CRM_Core_BAO_Job',
224 'label' => ts("Last Run"),
228 'scheduled_run_date' => [
229 'name' => 'scheduled_run_date',
230 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
231 'title' => ts('Scheduled Run Date'),
232 'description' => ts('When is this cron entry scheduled to run'),
234 'where' => 'civicrm_job.scheduled_run_date',
236 'table_name' => 'civicrm_job',
238 'bao' => 'CRM_Core_BAO_Job',
241 'label' => ts("Scheduled Run Date"),
247 'type' => CRM_Utils_Type
::T_STRING
,
248 'title' => ts('Job Name'),
249 'description' => ts('Title of the job'),
251 'size' => CRM_Utils_Type
::HUGE
,
252 'where' => 'civicrm_job.name',
253 'table_name' => 'civicrm_job',
255 'bao' => 'CRM_Core_BAO_Job',
260 'name' => 'description',
261 'type' => CRM_Utils_Type
::T_STRING
,
262 'title' => ts('Job Description'),
263 'description' => ts('Description of the job'),
265 'size' => CRM_Utils_Type
::HUGE
,
266 'where' => 'civicrm_job.description',
267 'table_name' => 'civicrm_job',
269 'bao' => 'CRM_Core_BAO_Job',
274 'name' => 'api_entity',
275 'type' => CRM_Utils_Type
::T_STRING
,
276 'title' => ts('API Entity'),
277 'description' => ts('Entity of the job api call'),
279 'size' => CRM_Utils_Type
::HUGE
,
280 'where' => 'civicrm_job.api_entity',
281 'table_name' => 'civicrm_job',
283 'bao' => 'CRM_Core_BAO_Job',
288 'name' => 'api_action',
289 'type' => CRM_Utils_Type
::T_STRING
,
290 'title' => ts('API Action'),
291 'description' => ts('Action of the job api call'),
293 'size' => CRM_Utils_Type
::HUGE
,
294 'where' => 'civicrm_job.api_action',
295 'table_name' => 'civicrm_job',
297 'bao' => 'CRM_Core_BAO_Job',
302 'name' => 'parameters',
303 'type' => CRM_Utils_Type
::T_TEXT
,
304 'title' => ts('API Parameters'),
305 'description' => ts('List of parameters to the command.'),
308 'where' => 'civicrm_job.parameters',
309 'table_name' => 'civicrm_job',
311 'bao' => 'CRM_Core_BAO_Job',
314 'type' => 'TextArea',
319 'name' => 'is_active',
320 'type' => CRM_Utils_Type
::T_BOOLEAN
,
321 'title' => ts('Job Is Active?'),
322 'description' => ts('Is this job active?'),
323 'where' => 'civicrm_job.is_active',
324 'table_name' => 'civicrm_job',
326 'bao' => 'CRM_Core_BAO_Job',
331 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
333 return Civi
::$statics[__CLASS__
]['fields'];
337 * Return a mapping from field-name to the corresponding key (as used in fields()).
340 * Array(string $name => string $uniqueName).
342 public static function &fieldKeys() {
343 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
344 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
346 return Civi
::$statics[__CLASS__
]['fieldKeys'];
350 * Returns the names of this table
354 public static function getTableName() {
355 return self
::$_tableName;
359 * Returns if this table needs to be logged
363 public function getLog() {
368 * Returns the list of fields that can be imported
370 * @param bool $prefix
374 public static function &import($prefix = FALSE) {
375 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'job', $prefix, []);
380 * Returns the list of fields that can be exported
382 * @param bool $prefix
386 public static function &export($prefix = FALSE) {
387 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'job', $prefix, []);
392 * Returns the list of indices
394 * @param bool $localize
398 public static function indices($localize = TRUE) {
400 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;