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:6e3a5de515fda550b1b5aeb493c50f0b)
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 public static function getEntityTitle() {
126 * Returns foreign keys and entity references.
129 * [CRM_Core_Reference_Interface]
131 public static function getReferenceColumns() {
132 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
133 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
134 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
135 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
137 return Civi
::$statics[__CLASS__
]['links'];
141 * Returns all the column names of this table
145 public static function &fields() {
146 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
147 Civi
::$statics[__CLASS__
]['fields'] = [
150 'type' => CRM_Utils_Type
::T_INT
,
151 'title' => ts('Job ID'),
152 'description' => ts('Job Id'),
154 'where' => 'civicrm_job.id',
155 'table_name' => 'civicrm_job',
157 'bao' => 'CRM_Core_BAO_Job',
162 'name' => 'domain_id',
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Job Domain'),
165 'description' => ts('Which Domain is this scheduled job for'),
167 'where' => 'civicrm_job.domain_id',
168 'table_name' => 'civicrm_job',
170 'bao' => 'CRM_Core_BAO_Job',
172 'FKClassName' => 'CRM_Core_DAO_Domain',
173 'pseudoconstant' => [
174 'table' => 'civicrm_domain',
176 'labelColumn' => 'name',
181 'name' => 'run_frequency',
182 'type' => CRM_Utils_Type
::T_STRING
,
183 'title' => ts('Job Frequency'),
184 'description' => ts('Scheduled job run frequency.'),
186 'size' => CRM_Utils_Type
::EIGHT
,
187 'where' => 'civicrm_job.run_frequency',
188 'default' => 'Daily',
189 'table_name' => 'civicrm_job',
191 'bao' => 'CRM_Core_BAO_Job',
196 'pseudoconstant' => [
197 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
202 'name' => 'last_run',
203 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
204 'title' => ts('Last Run'),
205 'description' => ts('When was this cron entry last run'),
207 'where' => 'civicrm_job.last_run',
209 'table_name' => 'civicrm_job',
211 'bao' => 'CRM_Core_BAO_Job',
215 'scheduled_run_date' => [
216 'name' => 'scheduled_run_date',
217 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
218 'title' => ts('Scheduled Run Date'),
219 'description' => ts('When is this cron entry scheduled to run'),
221 'where' => 'civicrm_job.scheduled_run_date',
223 'table_name' => 'civicrm_job',
225 'bao' => 'CRM_Core_BAO_Job',
231 'type' => CRM_Utils_Type
::T_STRING
,
232 'title' => ts('Job Name'),
233 'description' => ts('Title of the job'),
235 'size' => CRM_Utils_Type
::HUGE
,
236 'where' => 'civicrm_job.name',
237 'table_name' => 'civicrm_job',
239 'bao' => 'CRM_Core_BAO_Job',
244 'name' => 'description',
245 'type' => CRM_Utils_Type
::T_STRING
,
246 'title' => ts('Job Description'),
247 'description' => ts('Description of the job'),
249 'size' => CRM_Utils_Type
::HUGE
,
250 'where' => 'civicrm_job.description',
251 'table_name' => 'civicrm_job',
253 'bao' => 'CRM_Core_BAO_Job',
258 'name' => 'api_entity',
259 'type' => CRM_Utils_Type
::T_STRING
,
260 'title' => ts('API Entity'),
261 'description' => ts('Entity of the job api call'),
263 'size' => CRM_Utils_Type
::HUGE
,
264 'where' => 'civicrm_job.api_entity',
265 'table_name' => 'civicrm_job',
267 'bao' => 'CRM_Core_BAO_Job',
272 'name' => 'api_action',
273 'type' => CRM_Utils_Type
::T_STRING
,
274 'title' => ts('API Action'),
275 'description' => ts('Action of the job api call'),
277 'size' => CRM_Utils_Type
::HUGE
,
278 'where' => 'civicrm_job.api_action',
279 'table_name' => 'civicrm_job',
281 'bao' => 'CRM_Core_BAO_Job',
286 'name' => 'parameters',
287 'type' => CRM_Utils_Type
::T_TEXT
,
288 'title' => ts('API Parameters'),
289 'description' => ts('List of parameters to the command.'),
292 'where' => 'civicrm_job.parameters',
293 'table_name' => 'civicrm_job',
295 'bao' => 'CRM_Core_BAO_Job',
298 'type' => 'TextArea',
303 'name' => 'is_active',
304 'type' => CRM_Utils_Type
::T_BOOLEAN
,
305 'title' => ts('Job Is Active?'),
306 'description' => ts('Is this job active?'),
307 'where' => 'civicrm_job.is_active',
308 'table_name' => 'civicrm_job',
310 'bao' => 'CRM_Core_BAO_Job',
315 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
317 return Civi
::$statics[__CLASS__
]['fields'];
321 * Return a mapping from field-name to the corresponding key (as used in fields()).
324 * Array(string $name => string $uniqueName).
326 public static function &fieldKeys() {
327 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
328 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
330 return Civi
::$statics[__CLASS__
]['fieldKeys'];
334 * Returns the names of this table
338 public static function getTableName() {
339 return self
::$_tableName;
343 * Returns if this table needs to be logged
347 public function getLog() {
352 * Returns the list of fields that can be imported
354 * @param bool $prefix
358 public static function &import($prefix = FALSE) {
359 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'job', $prefix, []);
364 * Returns the list of fields that can be exported
366 * @param bool $prefix
370 public static function &export($prefix = FALSE) {
371 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'job', $prefix, []);
376 * Returns the list of indices
378 * @param bool $localize
382 public static function indices($localize = TRUE) {
384 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;