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:75ec772bec625c1d315df0abadd2fca6)
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;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Which Domain is this scheduled job for
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
52 * Scheduled job run frequency.
55 * (SQL type: varchar(8))
56 * Note that values will be retrieved from the database as a string.
58 public $run_frequency;
61 * When was this cron entry last run
64 * (SQL type: timestamp)
65 * Note that values will be retrieved from the database as a string.
70 * When is this cron entry scheduled to run
73 * (SQL type: timestamp)
74 * Note that values will be retrieved from the database as a string.
76 public $scheduled_run_date;
82 * (SQL type: varchar(255))
83 * Note that values will be retrieved from the database as a string.
88 * Description of the job
91 * (SQL type: varchar(255))
92 * Note that values will be retrieved from the database as a string.
97 * Entity of the job api call
100 * (SQL type: varchar(255))
101 * Note that values will be retrieved from the database as a string.
106 * Action of the job api call
109 * (SQL type: varchar(255))
110 * Note that values will be retrieved from the database as a string.
115 * List of parameters to the command.
119 * Note that values will be retrieved from the database as a string.
124 * Is this job active?
126 * @var bool|string|null
127 * (SQL type: tinyint)
128 * Note that values will be retrieved from the database as a string.
135 public function __construct() {
136 $this->__table
= 'civicrm_job';
137 parent
::__construct();
141 * Returns localized title of this entity.
143 * @param bool $plural
144 * Whether to return the plural version of the title.
146 public static function getEntityTitle($plural = FALSE) {
147 return $plural ?
ts('Jobs') : ts('Job');
151 * Returns foreign keys and entity references.
154 * [CRM_Core_Reference_Interface]
156 public static function getReferenceColumns() {
157 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
158 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
159 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
160 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
162 return Civi
::$statics[__CLASS__
]['links'];
166 * Returns all the column names of this table
170 public static function &fields() {
171 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
172 Civi
::$statics[__CLASS__
]['fields'] = [
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Job ID'),
177 'description' => ts('Job ID'),
179 'where' => 'civicrm_job.id',
180 'table_name' => 'civicrm_job',
182 'bao' => 'CRM_Core_BAO_Job',
191 'name' => 'domain_id',
192 'type' => CRM_Utils_Type
::T_INT
,
193 'title' => ts('Domain ID'),
194 'description' => ts('Which Domain is this scheduled job for'),
196 'where' => 'civicrm_job.domain_id',
197 'table_name' => 'civicrm_job',
199 'bao' => 'CRM_Core_BAO_Job',
201 'FKClassName' => 'CRM_Core_DAO_Domain',
203 'label' => ts("Domain"),
205 'pseudoconstant' => [
206 'table' => 'civicrm_domain',
208 'labelColumn' => 'name',
213 'name' => 'run_frequency',
214 'type' => CRM_Utils_Type
::T_STRING
,
215 'title' => ts('Job Frequency'),
216 'description' => ts('Scheduled job run frequency.'),
218 'size' => CRM_Utils_Type
::EIGHT
,
219 'where' => 'civicrm_job.run_frequency',
220 'default' => 'Daily',
221 'table_name' => 'civicrm_job',
223 'bao' => 'CRM_Core_BAO_Job',
228 'pseudoconstant' => [
229 'callback' => 'CRM_Core_SelectValues::getJobFrequency',
234 'name' => 'last_run',
235 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
236 'title' => ts('Last Run'),
237 'description' => ts('When was this cron entry last run'),
239 'where' => 'civicrm_job.last_run',
241 'table_name' => 'civicrm_job',
243 'bao' => 'CRM_Core_BAO_Job',
246 'label' => ts("Last Run"),
250 'scheduled_run_date' => [
251 'name' => 'scheduled_run_date',
252 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
253 'title' => ts('Scheduled Run Date'),
254 'description' => ts('When is this cron entry scheduled to run'),
256 'where' => 'civicrm_job.scheduled_run_date',
258 'table_name' => 'civicrm_job',
260 'bao' => 'CRM_Core_BAO_Job',
263 'label' => ts("Scheduled Run Date"),
269 'type' => CRM_Utils_Type
::T_STRING
,
270 'title' => ts('Job Name'),
271 'description' => ts('Title of the job'),
273 'size' => CRM_Utils_Type
::HUGE
,
274 'where' => 'civicrm_job.name',
275 'table_name' => 'civicrm_job',
277 'bao' => 'CRM_Core_BAO_Job',
282 'name' => 'description',
283 'type' => CRM_Utils_Type
::T_STRING
,
284 'title' => ts('Job Description'),
285 'description' => ts('Description of the job'),
287 'size' => CRM_Utils_Type
::HUGE
,
288 'where' => 'civicrm_job.description',
289 'table_name' => 'civicrm_job',
291 'bao' => 'CRM_Core_BAO_Job',
296 'name' => 'api_entity',
297 'type' => CRM_Utils_Type
::T_STRING
,
298 'title' => ts('API Entity'),
299 'description' => ts('Entity of the job api call'),
301 'size' => CRM_Utils_Type
::HUGE
,
302 'where' => 'civicrm_job.api_entity',
303 'table_name' => 'civicrm_job',
305 'bao' => 'CRM_Core_BAO_Job',
310 'name' => 'api_action',
311 'type' => CRM_Utils_Type
::T_STRING
,
312 'title' => ts('API Action'),
313 'description' => ts('Action of the job api call'),
315 'size' => CRM_Utils_Type
::HUGE
,
316 'where' => 'civicrm_job.api_action',
317 'table_name' => 'civicrm_job',
319 'bao' => 'CRM_Core_BAO_Job',
324 'name' => 'parameters',
325 'type' => CRM_Utils_Type
::T_TEXT
,
326 'title' => ts('API Parameters'),
327 'description' => ts('List of parameters to the command.'),
330 'where' => 'civicrm_job.parameters',
331 'table_name' => 'civicrm_job',
333 'bao' => 'CRM_Core_BAO_Job',
336 'type' => 'TextArea',
341 'name' => 'is_active',
342 'type' => CRM_Utils_Type
::T_BOOLEAN
,
343 'title' => ts('Job Is Active?'),
344 'description' => ts('Is this job active?'),
345 'where' => 'civicrm_job.is_active',
346 'table_name' => 'civicrm_job',
348 'bao' => 'CRM_Core_BAO_Job',
353 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
355 return Civi
::$statics[__CLASS__
]['fields'];
359 * Return a mapping from field-name to the corresponding key (as used in fields()).
362 * Array(string $name => string $uniqueName).
364 public static function &fieldKeys() {
365 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
366 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
368 return Civi
::$statics[__CLASS__
]['fieldKeys'];
372 * Returns the names of this table
376 public static function getTableName() {
377 return self
::$_tableName;
381 * Returns if this table needs to be logged
385 public function getLog() {
390 * Returns the list of fields that can be imported
392 * @param bool $prefix
396 public static function &import($prefix = FALSE) {
397 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'job', $prefix, []);
402 * Returns the list of fields that can be exported
404 * @param bool $prefix
408 public static function &export($prefix = FALSE) {
409 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'job', $prefix, []);
414 * Returns the list of indices
416 * @param bool $localize
420 public static function indices($localize = TRUE) {
422 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;