| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Core/Job.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:6a87295b587fb722d7b2026e2f2dbfe7) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the Job entity. |
| 14 | */ |
| 15 | class CRM_Core_DAO_Job extends CRM_Core_DAO { |
| 16 | |
| 17 | /** |
| 18 | * Static instance to hold the table name. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | static $_tableName = 'civicrm_job'; |
| 23 | |
| 24 | /** |
| 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 26 | * |
| 27 | * @var bool |
| 28 | */ |
| 29 | static $_log = FALSE; |
| 30 | |
| 31 | /** |
| 32 | * Job Id |
| 33 | * |
| 34 | * @var int unsigned |
| 35 | */ |
| 36 | public $id; |
| 37 | |
| 38 | /** |
| 39 | * Which Domain is this scheduled job for |
| 40 | * |
| 41 | * @var int unsigned |
| 42 | */ |
| 43 | public $domain_id; |
| 44 | |
| 45 | /** |
| 46 | * Scheduled job run frequency. |
| 47 | * |
| 48 | * @var string |
| 49 | */ |
| 50 | public $run_frequency; |
| 51 | |
| 52 | /** |
| 53 | * When was this cron entry last run |
| 54 | * |
| 55 | * @var timestamp |
| 56 | */ |
| 57 | public $last_run; |
| 58 | |
| 59 | /** |
| 60 | * When is this cron entry scheduled to run |
| 61 | * |
| 62 | * @var timestamp |
| 63 | */ |
| 64 | public $scheduled_run_date; |
| 65 | |
| 66 | /** |
| 67 | * Title of the job |
| 68 | * |
| 69 | * @var string |
| 70 | */ |
| 71 | public $name; |
| 72 | |
| 73 | /** |
| 74 | * Description of the job |
| 75 | * |
| 76 | * @var string |
| 77 | */ |
| 78 | public $description; |
| 79 | |
| 80 | /** |
| 81 | * Entity of the job api call |
| 82 | * |
| 83 | * @var string |
| 84 | */ |
| 85 | public $api_entity; |
| 86 | |
| 87 | /** |
| 88 | * Action of the job api call |
| 89 | * |
| 90 | * @var string |
| 91 | */ |
| 92 | public $api_action; |
| 93 | |
| 94 | /** |
| 95 | * List of parameters to the command. |
| 96 | * |
| 97 | * @var text |
| 98 | */ |
| 99 | public $parameters; |
| 100 | |
| 101 | /** |
| 102 | * Is this job active? |
| 103 | * |
| 104 | * @var boolean |
| 105 | */ |
| 106 | public $is_active; |
| 107 | |
| 108 | /** |
| 109 | * Class constructor. |
| 110 | */ |
| 111 | public function __construct() { |
| 112 | $this->__table = 'civicrm_job'; |
| 113 | parent::__construct(); |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Returns foreign keys and entity references. |
| 118 | * |
| 119 | * @return array |
| 120 | * [CRM_Core_Reference_Interface] |
| 121 | */ |
| 122 | public static function getReferenceColumns() { |
| 123 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
| 124 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); |
| 125 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
| 126 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
| 127 | } |
| 128 | return Civi::$statics[__CLASS__]['links']; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Returns all the column names of this table |
| 133 | * |
| 134 | * @return array |
| 135 | */ |
| 136 | public static function &fields() { |
| 137 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 138 | Civi::$statics[__CLASS__]['fields'] = [ |
| 139 | 'id' => [ |
| 140 | 'name' => 'id', |
| 141 | 'type' => CRM_Utils_Type::T_INT, |
| 142 | 'title' => ts('Job ID'), |
| 143 | 'description' => ts('Job Id'), |
| 144 | 'required' => TRUE, |
| 145 | 'table_name' => 'civicrm_job', |
| 146 | 'entity' => 'Job', |
| 147 | 'bao' => 'CRM_Core_BAO_Job', |
| 148 | 'localizable' => 0, |
| 149 | ], |
| 150 | 'domain_id' => [ |
| 151 | 'name' => 'domain_id', |
| 152 | 'type' => CRM_Utils_Type::T_INT, |
| 153 | 'title' => ts('Job Domain'), |
| 154 | 'description' => ts('Which Domain is this scheduled job for'), |
| 155 | 'required' => TRUE, |
| 156 | 'table_name' => 'civicrm_job', |
| 157 | 'entity' => 'Job', |
| 158 | 'bao' => 'CRM_Core_BAO_Job', |
| 159 | 'localizable' => 0, |
| 160 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
| 161 | 'pseudoconstant' => [ |
| 162 | 'table' => 'civicrm_domain', |
| 163 | 'keyColumn' => 'id', |
| 164 | 'labelColumn' => 'name', |
| 165 | ] |
| 166 | ], |
| 167 | 'run_frequency' => [ |
| 168 | 'name' => 'run_frequency', |
| 169 | 'type' => CRM_Utils_Type::T_STRING, |
| 170 | 'title' => ts('Job Frequency'), |
| 171 | 'description' => ts('Scheduled job run frequency.'), |
| 172 | 'maxlength' => 8, |
| 173 | 'size' => CRM_Utils_Type::EIGHT, |
| 174 | 'default' => 'Daily', |
| 175 | 'table_name' => 'civicrm_job', |
| 176 | 'entity' => 'Job', |
| 177 | 'bao' => 'CRM_Core_BAO_Job', |
| 178 | 'localizable' => 0, |
| 179 | 'html' => [ |
| 180 | 'type' => 'Select', |
| 181 | ], |
| 182 | 'pseudoconstant' => [ |
| 183 | 'callback' => 'CRM_Core_SelectValues::getJobFrequency', |
| 184 | ] |
| 185 | ], |
| 186 | 'last_run' => [ |
| 187 | 'name' => 'last_run', |
| 188 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
| 189 | 'title' => ts('Last Run'), |
| 190 | 'description' => ts('When was this cron entry last run'), |
| 191 | 'required' => FALSE, |
| 192 | 'default' => 'NULL', |
| 193 | 'table_name' => 'civicrm_job', |
| 194 | 'entity' => 'Job', |
| 195 | 'bao' => 'CRM_Core_BAO_Job', |
| 196 | 'localizable' => 0, |
| 197 | ], |
| 198 | 'scheduled_run_date' => [ |
| 199 | 'name' => 'scheduled_run_date', |
| 200 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
| 201 | 'title' => ts('Scheduled Run Date'), |
| 202 | 'description' => ts('When is this cron entry scheduled to run'), |
| 203 | 'required' => FALSE, |
| 204 | 'default' => 'NULL', |
| 205 | 'table_name' => 'civicrm_job', |
| 206 | 'entity' => 'Job', |
| 207 | 'bao' => 'CRM_Core_BAO_Job', |
| 208 | 'localizable' => 0, |
| 209 | ], |
| 210 | 'name' => [ |
| 211 | 'name' => 'name', |
| 212 | 'type' => CRM_Utils_Type::T_STRING, |
| 213 | 'title' => ts('Job Name'), |
| 214 | 'description' => ts('Title of the job'), |
| 215 | 'maxlength' => 255, |
| 216 | 'size' => CRM_Utils_Type::HUGE, |
| 217 | 'table_name' => 'civicrm_job', |
| 218 | 'entity' => 'Job', |
| 219 | 'bao' => 'CRM_Core_BAO_Job', |
| 220 | 'localizable' => 0, |
| 221 | ], |
| 222 | 'description' => [ |
| 223 | 'name' => 'description', |
| 224 | 'type' => CRM_Utils_Type::T_STRING, |
| 225 | 'title' => ts('Job Description'), |
| 226 | 'description' => ts('Description of the job'), |
| 227 | 'maxlength' => 255, |
| 228 | 'size' => CRM_Utils_Type::HUGE, |
| 229 | 'table_name' => 'civicrm_job', |
| 230 | 'entity' => 'Job', |
| 231 | 'bao' => 'CRM_Core_BAO_Job', |
| 232 | 'localizable' => 0, |
| 233 | ], |
| 234 | 'api_entity' => [ |
| 235 | 'name' => 'api_entity', |
| 236 | 'type' => CRM_Utils_Type::T_STRING, |
| 237 | 'title' => ts('API Entity'), |
| 238 | 'description' => ts('Entity of the job api call'), |
| 239 | 'maxlength' => 255, |
| 240 | 'size' => CRM_Utils_Type::HUGE, |
| 241 | 'table_name' => 'civicrm_job', |
| 242 | 'entity' => 'Job', |
| 243 | 'bao' => 'CRM_Core_BAO_Job', |
| 244 | 'localizable' => 0, |
| 245 | ], |
| 246 | 'api_action' => [ |
| 247 | 'name' => 'api_action', |
| 248 | 'type' => CRM_Utils_Type::T_STRING, |
| 249 | 'title' => ts('API Action'), |
| 250 | 'description' => ts('Action of the job api call'), |
| 251 | 'maxlength' => 255, |
| 252 | 'size' => CRM_Utils_Type::HUGE, |
| 253 | 'table_name' => 'civicrm_job', |
| 254 | 'entity' => 'Job', |
| 255 | 'bao' => 'CRM_Core_BAO_Job', |
| 256 | 'localizable' => 0, |
| 257 | ], |
| 258 | 'parameters' => [ |
| 259 | 'name' => 'parameters', |
| 260 | 'type' => CRM_Utils_Type::T_TEXT, |
| 261 | 'title' => ts('API Parameters'), |
| 262 | 'description' => ts('List of parameters to the command.'), |
| 263 | 'rows' => 4, |
| 264 | 'cols' => 60, |
| 265 | 'table_name' => 'civicrm_job', |
| 266 | 'entity' => 'Job', |
| 267 | 'bao' => 'CRM_Core_BAO_Job', |
| 268 | 'localizable' => 0, |
| 269 | 'html' => [ |
| 270 | 'type' => 'TextArea', |
| 271 | ], |
| 272 | ], |
| 273 | 'is_active' => [ |
| 274 | 'name' => 'is_active', |
| 275 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 276 | 'title' => ts('Job Is Active?'), |
| 277 | 'description' => ts('Is this job active?'), |
| 278 | 'table_name' => 'civicrm_job', |
| 279 | 'entity' => 'Job', |
| 280 | 'bao' => 'CRM_Core_BAO_Job', |
| 281 | 'localizable' => 0, |
| 282 | ], |
| 283 | ]; |
| 284 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 285 | } |
| 286 | return Civi::$statics[__CLASS__]['fields']; |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 291 | * |
| 292 | * @return array |
| 293 | * Array(string $name => string $uniqueName). |
| 294 | */ |
| 295 | public static function &fieldKeys() { |
| 296 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 297 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 298 | } |
| 299 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Returns the names of this table |
| 304 | * |
| 305 | * @return string |
| 306 | */ |
| 307 | public static function getTableName() { |
| 308 | return self::$_tableName; |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * Returns if this table needs to be logged |
| 313 | * |
| 314 | * @return bool |
| 315 | */ |
| 316 | public function getLog() { |
| 317 | return self::$_log; |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * Returns the list of fields that can be imported |
| 322 | * |
| 323 | * @param bool $prefix |
| 324 | * |
| 325 | * @return array |
| 326 | */ |
| 327 | public static function &import($prefix = FALSE) { |
| 328 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'job', $prefix, []); |
| 329 | return $r; |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * Returns the list of fields that can be exported |
| 334 | * |
| 335 | * @param bool $prefix |
| 336 | * |
| 337 | * @return array |
| 338 | */ |
| 339 | public static function &export($prefix = FALSE) { |
| 340 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'job', $prefix, []); |
| 341 | return $r; |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * Returns the list of indices |
| 346 | * |
| 347 | * @param bool $localize |
| 348 | * |
| 349 | * @return array |
| 350 | */ |
| 351 | public static function indices($localize = TRUE) { |
| 352 | $indices = []; |
| 353 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 354 | } |
| 355 | |
| 356 | } |