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:bbc36abe96310ec5cf23d46d2d1728cb)
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',
165 'name' => 'domain_id',
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Job Domain'),
168 'description' => ts('Which Domain is this scheduled job for'),
170 'where' => 'civicrm_job.domain_id',
171 'table_name' => 'civicrm_job',
173 'bao' => 'CRM_Core_BAO_Job',
175 'FKClassName' => 'CRM_Core_DAO_Domain',
176 'pseudoconstant' => [
177 'table' => 'civicrm_domain',
179 'labelColumn' => 'name',
184 'name' => 'run_frequency',
185 'type' => CRM_Utils_Type
::T_STRING
,
186 'title' => ts('Job Frequency'),
187 'description' => ts('Scheduled job run frequency.'),
189 'size' => CRM_Utils_Type
::EIGHT
,
190 'where' => 'civicrm_job.run_frequency',
191 'default' => 'Daily',
192 'table_name' => 'civicrm_job',
194 'bao' => 'CRM_Core_BAO_Job',
199 'pseudoconstant' => [
200 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
205 'name' => 'last_run',
206 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
207 'title' => ts('Last Run'),
208 'description' => ts('When was this cron entry last run'),
210 'where' => 'civicrm_job.last_run',
212 'table_name' => 'civicrm_job',
214 'bao' => 'CRM_Core_BAO_Job',
218 'scheduled_run_date' => [
219 'name' => 'scheduled_run_date',
220 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
221 'title' => ts('Scheduled Run Date'),
222 'description' => ts('When is this cron entry scheduled to run'),
224 'where' => 'civicrm_job.scheduled_run_date',
226 'table_name' => 'civicrm_job',
228 'bao' => 'CRM_Core_BAO_Job',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Job Name'),
236 'description' => ts('Title of the job'),
238 'size' => CRM_Utils_Type
::HUGE
,
239 'where' => 'civicrm_job.name',
240 'table_name' => 'civicrm_job',
242 'bao' => 'CRM_Core_BAO_Job',
247 'name' => 'description',
248 'type' => CRM_Utils_Type
::T_STRING
,
249 'title' => ts('Job Description'),
250 'description' => ts('Description of the job'),
252 'size' => CRM_Utils_Type
::HUGE
,
253 'where' => 'civicrm_job.description',
254 'table_name' => 'civicrm_job',
256 'bao' => 'CRM_Core_BAO_Job',
261 'name' => 'api_entity',
262 'type' => CRM_Utils_Type
::T_STRING
,
263 'title' => ts('API Entity'),
264 'description' => ts('Entity of the job api call'),
266 'size' => CRM_Utils_Type
::HUGE
,
267 'where' => 'civicrm_job.api_entity',
268 'table_name' => 'civicrm_job',
270 'bao' => 'CRM_Core_BAO_Job',
275 'name' => 'api_action',
276 'type' => CRM_Utils_Type
::T_STRING
,
277 'title' => ts('API Action'),
278 'description' => ts('Action of the job api call'),
280 'size' => CRM_Utils_Type
::HUGE
,
281 'where' => 'civicrm_job.api_action',
282 'table_name' => 'civicrm_job',
284 'bao' => 'CRM_Core_BAO_Job',
289 'name' => 'parameters',
290 'type' => CRM_Utils_Type
::T_TEXT
,
291 'title' => ts('API Parameters'),
292 'description' => ts('List of parameters to the command.'),
295 'where' => 'civicrm_job.parameters',
296 'table_name' => 'civicrm_job',
298 'bao' => 'CRM_Core_BAO_Job',
301 'type' => 'TextArea',
306 'name' => 'is_active',
307 'type' => CRM_Utils_Type
::T_BOOLEAN
,
308 'title' => ts('Job Is Active?'),
309 'description' => ts('Is this job active?'),
310 'where' => 'civicrm_job.is_active',
311 'table_name' => 'civicrm_job',
313 'bao' => 'CRM_Core_BAO_Job',
318 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
320 return Civi
::$statics[__CLASS__
]['fields'];
324 * Return a mapping from field-name to the corresponding key (as used in fields()).
327 * Array(string $name => string $uniqueName).
329 public static function &fieldKeys() {
330 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
331 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
333 return Civi
::$statics[__CLASS__
]['fieldKeys'];
337 * Returns the names of this table
341 public static function getTableName() {
342 return self
::$_tableName;
346 * Returns if this table needs to be logged
350 public function getLog() {
355 * Returns the list of fields that can be imported
357 * @param bool $prefix
361 public static function &import($prefix = FALSE) {
362 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'job', $prefix, []);
367 * Returns the list of fields that can be exported
369 * @param bool $prefix
373 public static function &export($prefix = FALSE) {
374 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'job', $prefix, []);
379 * Returns the list of indices
381 * @param bool $localize
385 public static function indices($localize = TRUE) {
387 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;